|
|
|
|
|
by enriquto
1256 days ago
|
|
> not having exact integers What do you mean? Floating-point arithmetic is, by design, exact for small integers. The result of adding 2.0 to 3.0 is exactly 5.0. This is one of the few cases where it is perfectly legitimate to compare floats for equality. In fact, using 64-bit doubles to represent ints you get way more ints than using plain 32-bit ints. Thus, choosing doubles to represent integers makes perfect sense (unless you worry about wasting a bit of memory and performance). |
|
Does JS at least write ".0" at the end when converting a number to a string? Or switch to scientific notation for large numbers?