Skip to content

Commit

Permalink
added culture independent parsing (#3731)
Browse files Browse the repository at this point in the history
  • Loading branch information
srsaggam authored Jul 12, 2019
1 parent d518b58 commit a15aaa7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Microsoft.ML.AutoML/Utils/MLNetUtils/Conversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Globalization;

namespace Microsoft.ML.AutoML
{
Expand All @@ -25,7 +26,7 @@ public static bool TryParse(in TX src, out R4 dst)
dst = R4.NaN;
return true;
}
if (float.TryParse(str, out dst))
if (float.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture, out dst))
{
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.ML.AutoML/Utils/SweepableParamAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Globalization;
using System.Linq;
using System.Text;

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

public override void SetUsingValueText(string valueText)
{
RawValue = float.Parse(valueText);
RawValue = float.Parse(valueText, CultureInfo.InvariantCulture);
}

public override SweepableParam Clone() =>
Expand Down

0 comments on commit a15aaa7

Please sign in to comment.