Convert.ToDoubleInvariant not converting properly in preview version

Apperantly it has some problems with scientific notation or with exceeding type:
It gives us error for value " -3,40282346638529E38" but as well “-3,40282346638529E7”

Anyone has the same issue?

What platform, and can we get a complete test case?

Note that Invariant won’t handle “,”. “.” is the decimal separator for the invariant locale.

It is in java.
If “.” is the separator then why “-3,40282346638529E7” works?

Beats me.

In any case, can you send me a complete testcase?

Hi
Here is a test case with proposed fix TestConvert_ToDouble.zip (406.1 KB)
The last fix on Github for Convert.ToDouble (changing E to E+) is incorrect in my opinion. Please open my project, run the test, then uncomment RTL methods to see errors and repeat the test. I also added a changed class method TryToDouble from RTL to show the possible fix.

Hi, fixed today, all your test cases are working.
Thanks!

2 Likes