I have yet to find a number that toFixed10 does wrong. Can anybody else?
Thanks to blg
and his answer which pointed me to Mozilla’s toFixed10() method.
Using that I came up with this short one liner, which indeed covers all cases mentioned here…
function toFixed( num, precision ) {
return (+(Math.round(+(num + 'e' + precision)) + 'e' + -precision)).toFixed(precision);
}