Skip to content

Support of scientific notation #209

@Kukunin

Description

@Kukunin

I believe that bn.js should support scientific notation for big numbers: a number 5e+21 or a string "5e+21" or both.

Current situation:

new BN('500000000000000000000').toString() // works well
new BN('5e+21').toString() // returns 63521 for some reason
new BN(500000000000000000000).toString() // throws Error: Assertion failed
new BN(5e+21).toString() // throws Error: Assertion failed

I don't know the reasons behind the assertion of big numbers, but at least it can support scientific notation as a string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions