Created attachment 43667 [details] source Number.toFixed returns sometimes wrong values (incorect rounding). Please run attachment. Actual Results: ( 0.95 ) . toFixed ( 1 ) = 0.9 THOUGH ( 9.5 ) . toFixed ( 0 ) = 10 Expected Results: ( 0.95 ) . toFixed ( 1 ) = 1.0 LIKE ( 9.5 ) . toFixed ( 0 ) = 10
Duplicate of bug 24711?
toFixed rounds, not floors ! bug 24711 is not a Bug !! (1.95) . toFixed( 1 ) = 2.0 because: Math.round ( 1.95 * 10 ) / 10 equal 2
All browsers before returns string value (IE, Opera, Konqueror, Chrome, Firefox) rounding a Number.
yep, this is a dupe. ieee754(.95) < decimal(.95), hence rounds up to 0.9 (ecma-262 15.7.4.5 requires we select the nearest value). ieee754(9.5) == decimal(9.5), hence rounds up to 10 (ecma-262 15.7.4.5 requires we select the larger to two equally near values). *** This bug has been marked as a duplicate of bug 24711 ***