Other anomalies in string conversion (was Re: Math.cbrt cube root would be nice)

# Roger Andrews (14 years ago)

Following on from my tedious nit-picking about the string conversion of -0 ...

JavaScript arithmetic rightly uses rounding mode "nearTiesEven" (aka. Banker's Rounding). But the specification is for decimal rounding in the string conversion functions uses "nearTiesAway" (i.e. rounding ties away from 0), which may yield an unexpected least-significant decimal digit.

Firefox 3.6 went even weirder in decimal rounding, using rounding mode "nearTiesEven" for rounding integers < 1e15, but "nearTiesAway" for larger integers and fractions (for those few fractional decimal ties that can be stored exactly in binary, such as half-integers).