Skip to content

Commit a15aaa7

Browse files
authored
added culture independent parsing (#3731)
1 parent d518b58 commit a15aaa7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Microsoft.ML.AutoML/Utils/MLNetUtils/Conversions.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6+
using System.Globalization;
67

78
namespace Microsoft.ML.AutoML
89
{
@@ -25,7 +26,7 @@ public static bool TryParse(in TX src, out R4 dst)
2526
dst = R4.NaN;
2627
return true;
2728
}
28-
if (float.TryParse(str, out dst))
29+
if (float.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out dst))
2930
{
3031
return true;
3132
}

src/Microsoft.ML.AutoML/Utils/SweepableParamAttributes.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6+
using System.Globalization;
67
using System.Linq;
78
using System.Text;
89

@@ -144,7 +145,7 @@ public SweepableFloatParam(float min, float max, float stepSize = -1, int numSte
144145

145146
public override void SetUsingValueText(string valueText)
146147
{
147-
RawValue = float.Parse(valueText);
148+
RawValue = float.Parse(valueText, CultureInfo.InvariantCulture);
148149
}
149150

150151
public override SweepableParam Clone() =>

0 commit comments

Comments
 (0)