Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web3 1.0 Breaks BigNumbers #1016

Closed
dskvr opened this issue Sep 4, 2017 · 3 comments
Closed

Web3 1.0 Breaks BigNumbers #1016

dskvr opened this issue Sep 4, 2017 · 3 comments
Assignees
Labels
Bug Addressing a bug

Comments

@dskvr
Copy link

dskvr commented Sep 4, 2017

It appears that the new web3.utils.toBN does not return a true BigNumber object. It's missing a number of it's most critical functions, including but not limited to

toFixed()
toFormat()

I confirmed this by including BigNumbers.js separately, creating a new BigNumber() from web3's BigNumber object, and then calling toFixed() (it worked). If this was intentional, it should be noted somewhere.

@TheRyanHickman
Copy link

Having same issue.
let tokens = web3.utils.toBN(result).toString()

image

@li-dennis
Copy link

+1 on this. If you look at the library used, https://github.com/SilentCicero/number-to-bn, it says in the README that decimals aren't supported...

A simple method to convert integer or hex integer numbers to BN.js object instances. Does not supprot decimal numbers.

console.log(numberToBN('0.9')); // or {}, [], undefined, 9.9

// throws new Error(...)

@nivida nivida self-assigned this Aug 9, 2018
@nivida nivida added the Bug Addressing a bug label Nov 29, 2018
@nivida
Copy link
Contributor

nivida commented Feb 27, 2019

We have started a discussion here about the future of big numbers and Web3.js.

@nivida nivida closed this as completed Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

4 participants