And just when one thinks every stone is over turned, more web searching digs up that others have found that toFixed(2); is problematic between different browsers and have concluded the safest method is to use your own rounding function, 'just to be sure!'
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Sun 2019.08.25
And just when one thinks every stone is over turned, more web searching digs up that others have found that
toFixed(2);
is problematic between different browsers and have concluded the safest method is to use your own rounding function, 'just to be sure!'A link there over turns this relatively recent 'fix' - "Revision 1383484 of Math.round()"
"Rounding 1.005 should have an expected result of 1.01, but it returns 1."
So, what do we know so far for function toFixed()?
by definition:
EXCEPT when it doesn't, then one must apply a patch that is only discovered when locating the recommended fix as suggested in revision 1383484.
Pardon me while I go scream!!