Is there a JVM implementation of the JavaScript `Number.toString()` method somewhere? (see <https://...
m
Is there a JVM implementation of the JavaScript
Number.toString()
method somewhere? (see https://youtrack.jetbrains.com/issue/KT-33358). I need to write some JVM code that maps 1:1 with some JS code.
e
JS Number.toString is partly implementation-defined, not standardized: https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.prototype.tostring
🤯 1
👀 1
m
Yikes
Thanks for the pointer though 💙 !
I guess a "NodeJS" version would fit my needs for the time being if there such a thing
But since it's not standardized, I guess it's not something I can find "on the shelf" easily
e
node.js behavior is effectively v8 (except for the chakracore version but I don't think anybody is using that anymore)
v8 behavior isn't necessarily fixed; http://code.google.com/p/v8/issues/detail?id=1627
👀 1
hey you may be in luck, it looks like Rhino ported V8's algorithm, https://github.com/mozilla/rhino/tree/master/src/org/mozilla/javascript/v8dtoa
💙 1
m
Oohhh Thanks! Will look into this!