-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
toPrecision() in Edge gives incorrect output in rare cases #3929
Comments
Definitely seems like a real bug and something we should fix. That code is crazy complicated, so I can't immediately understand the problem. Looks like something is going wrong inside |
So, toPrecision(3) |
@dajp1 the expected output for your sample should be However ChakraCore (as reported) results in |
@obastemur I don't agree. As far as I can see, the specification says that toPrecision() should return a string to the specified number of significant digits, and examples always start with the first non-zero digit. In my case I was expecting "0.000300" since that has three significant digits starting with the first non-zero digit, and this is what I get on every browser I have tried except Edge. If precision was set to 4, I would expect "0.0003000", which is indeed what I get (on Edge, IE, Firefox and Chrome). The bug only appears when the number of significant digits is set to three or fewer. |
Sorry - newbie mistake, I pressed the wrong button. Didn't mean to close this issue. |
I agree on that. A |
Stumbled upon a similar issue with |
Just tested. Yes, the fix covers that case too. |
My apologies if this is the wrong place to submit this.
I have found what I suspect is a bug in Edge. In JavaScript, the lines:
result in b containing "0.000200". (IE, Chrome and Firefox all give the "0.000300" that I was expecting.)
See http://jsfiddle.net/dajp/2b47qLg0/
I'm using Edge 40.15063.0.0.
This is causing me some difficulties. Many thanks.
The text was updated successfully, but these errors were encountered: