-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double.Parse rounding bug when there are trailing zeroes in the input string #46827
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @tannergooding, @pgovind Issue DetailsDescriptionCode to reproduce: using System;
class Program {
public static void Main(string[] args) {
Console.WriteLine("{0:R}", double.Parse("9007199254740997"));
Console.WriteLine("{0:R}", double.Parse("900719925474099.7e+1"));
Console.WriteLine("{0:R}", double.Parse("9007199254740997.0"));
Console.WriteLine("{0:R}", double.Parse("90071992547409970e-1"));
}
} Actual output:
Expected: All four outputs should be the same. (9007199254740996 if rounding to even) Configuration
|
Looks like a bug. I'll investigate this as I work on #46874 next week! |
Yup, reproduced it locally. Will look into this further this week. This happens because of rounding due to the call here. The Meanwhile, how did you find this bug? |
Description
Code to reproduce:
Actual output:
Expected: All four outputs should be the same. (9007199254740996 if rounding to even)
Configuration
The text was updated successfully, but these errors were encountered: