JoeStrout / miniscript

source code of both C# and C++ implementations of the MiniScript scripting language
MIT License
275 stars 64 forks source link

Wrong double value in double.TryParse #20

Closed andreakarasho closed 4 years ago

andreakarasho commented 4 years ago

If you run the simple miniscript.exe in REPL and write: 0.1, the console output will show you 1 as value. This is an inconsistent result due to the cultureinfo. I fixed it putting:

double.TryParse("0.1", NumberStyles.Any, CultureInfo.InvariantCulture, out double value);
JoeStrout commented 4 years ago

Great catch! There are probably other places where the code is not international-savvy. I'll need to do an audit to catch them all (but this a good start).

JoeStrout commented 4 years ago

@andreakarasho, this update fixes all the cases I could find in my tests, but I'd love to hear confirmation that it also fixes it for you.