Repository navigation
Never use exponential if radix not 10 (Fix #3739, #3740) - #3742
Conversation
dilijev
left a comment
There was a problem hiding this comment.
I'll let others weigh in about the behavior change.
| runTest('new Number(-444123.78963636363636363636)'); | ||
| runTest('new Number(0)'); | ||
| runTest('1e21'); | ||
| runTest('1.1e21'); |
There was a problem hiding this comment.
Maybe also add tests for 1e21+1 and 1e21-1 (integers one before and after the boundary) and compare output with other engines. Maybe 1e21+0.1 and 1e21-0.1 also?
There was a problem hiding this comment.
These numbers all equal to 1e21 due to the loss of precision. How about adding 0.9999999999999999e21 and 1.0000000000000001e21?
There was a problem hiding this comment.
Yeah, that sounds good. :)
|
@dotnet-bot test Ubuntu static_ubuntu_linux_test please |
|
Any updates on this? I believe it is blocking nodejs/node-chakracore#390. |
|
So just for fun I did some archeology to see why we are doing this, and turns out this code goes all the way back to at least 2002 (when it was copied between source trees). I don't think anyone has considered this behavior in a very long time. Seems to me like a fine change to get compat with the other browsers. |
|
@MikeHolman can you adopt and merge this PR? |
|
Spoke with @MikeHolman - I'll test this one internally and then merge it. |
|
Note: merging to release/1.7 to unblock the node-chakracore scenario: #3742 (comment) |
, #3740) Merge pull request #3742 from xiaoyinl:never_use_exp Other engines (SpiderMonkey, JSC and V8) never use exponential display for num.toString(radix) if radix is not 10, no matter how large num is. This PR updates the code and the test cases to match that behavior. This PR fixes #3739 and fixes #3740. See also: #2751, #3635. /cc @dilijev @littledan @bterlson
…ot 10 (Fix #3739, #3740) Merge pull request #3742 from xiaoyinl:never_use_exp Other engines (SpiderMonkey, JSC and V8) never use exponential display for num.toString(radix) if radix is not 10, no matter how large num is. This PR updates the code and the test cases to match that behavior. This PR fixes #3739 and fixes #3740. See also: #2751, #3635. /cc @dilijev @littledan @bterlson
Other engines (SpiderMonkey, JSC and V8) never use exponential display for num.toString(radix) if radix is not 10, no matter how large num is. This PR updates the code and the test cases to match that behavior.
This PR fixes #3739 and fixes #3740.
See also: #2751, #3635.
/cc @dilijev @littledan @bterlson