Closed gustavlrsn closed 1 year ago
Updated the method to handle values that are represented in exponential notation, and fixing #166. Also refactored the method a little bit with more comments explaining what it does. Also added tests for testing incoming values in exponential/scientific notation.
Fixes an inconsistency between
toFixed
andformatNumber
referenced in #164.Updating
toFixed
so that it rounds negative values away from zero, to be in consistence with howformatNumber
and thusformatMoney
has been working.Also adding some tests to
formatNumber
to clarify this current (& past) behaviour of rounding negative values away from zero.Before:
with this fix: