Michael Greminger 6fa589057e
Big Number Format Fixes (#2956)
* test: format bignumber to engineering bug

Add tests for correctly handling starting with more then 3 sig figs and targeting 1 or 2 sig figs

* lint:

* lint: reduce number literal sig figs

* fix: engineering notation for bignumber input

Corrects handling of cases where the input has 3 or more sig figs and the output is set to 1 or 2 sig figs.

* test: add negative format bignumber precision test

* fix: use BigNumber for all branches in toEngineering

Also, remove string type option from JSDoc for toEngineering since string does support the required interface for the function (the .e property, .mul member function, and the .constructor property would not be correct after this change)

* fix: precision 0 for fixed notation and bignumber

This fix differentiates precision === 0 and precision === undefined to.
After fix, format bignumber for precision 0 matches format number for precision 0.

Tests added as well

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2023-06-13 10:39:44 +02:00
..
2023-06-13 10:39:44 +02:00