MikeMcl / bignumber.js

A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic
http://mikemcl.github.io/bignumber.js
MIT License
6.69k stars 742 forks source link

new BigNumber does not create correct representation of a string #263

Closed SeedyROM closed 4 years ago

SeedyROM commented 4 years ago

Certain strings given to the BigNumber constructor do not get accurately converted.

Info

Example

> const x = new BigNumber('1312581780427512882148')
undefined
> x
BigNumber { s: 1, e: 21, c: [ 13125817, 80427512882148 ] }
> x.toString()
'1.312581780427512882148e+21'
SeedyROM commented 4 years ago

Was looking for toFixed duhhhh.