tc39 / proposal-number-fromstring

{BigInt,Number}.fromString(string, radix)
https://mathiasbynens.github.io/proposal-number-fromstring/
65 stars 7 forks source link

Spec: “mathematical integer value” / “mathematical number value” #16

Open mathiasbynens opened 6 years ago

mathiasbynens commented 6 years ago

The spec text relies on the terms “mathematical integer value” (as used for parseInt) for BigInt.fromString, and “mathematical number value” for Number.fromString. The intention is for the latter to cover things like exponential notation (#10), but it doesn’t seem clearly defined whether that’s actually the case. Is it?

We also need to support things like Infinity, -Infinity, NaN for Number.fromString. Are those covered by this phrasing or not?

Suggestions for a less ambiguous way of specifying this are welcome!

domenic commented 6 years ago

Suggestions for a less ambiguous way of specifying this are welcome!

I would suggest doing something of similar style to that of the HTML algorithms mentioned in https://github.com/mathiasbynens/proposal-number-fromstring/issues/11.

Fixing this would indeed be a big improvement :)