ECMA-262 (13th ed.) §6.1.6.1 states that the values of a JS Number are those of a 64-bit float as defined in IEEE-754-2019. Does any major JS vendor provide a method (or a simple combination of methods) to find the smallest representable floating-point number greater than the target? (A C++ analog would be std::nextafter
).
Asked
Active
Viewed 23 times
0

aas
- 177
- 8
-
What do you count as "major JS vendor"? But the answer still appears to be "no". – Bergi Mar 25 '23 at 21:37
-
A major web browser or a major JS runtime? I don't know how I can define it further, except through brute enumeration. Whatever the opposite is of "this one guy's obscure Github project." – aas Mar 25 '23 at 22:07
-
[^](https://stackoverflow.com/questions/75844643/next-largest-representable-number-in-javascript#comment133783218_75844643) @aas Explicit enumeration provides clear scope — which helps make a question clear. – jsejcksn Mar 25 '23 at 22:09
-
If no vendor offers this functionality, narrowing down the list of vendors will not reveal one that does. – aas Mar 25 '23 at 22:12
-
1@aas In that case, you're looking for the JavaScript runtimes that are using the JVM (e.g. rhino, nashorn, graaljs etc) and have access to `java.lang.Math.nextAfter`. They aren't exactly mainstream (used in browsers or nodejs), but are not obscure one-person projects either. – Bergi Mar 25 '23 at 22:44
-
If the mostly moribund JVM-based runtimes are the best available, I consider this question answered. – aas Mar 26 '23 at 21:51