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

negative BigNumber values always return in exponential notation #1378

Closed
husayt opened this issue Jan 8, 2019 · 2 comments
Closed

negative BigNumber values always return in exponential notation #1378

husayt opened this issue Jan 8, 2019 · 2 comments
Labels

Comments

@husayt
Copy link

husayt commented Jan 8, 2019

negative BigNumber values always return in exponential notation ignoring formatOptions. I expect 1-2 = -1, but it returns 1-2 = -1e+0

let bigmath = math.create({
      number: "BigNumber" 
})

  const formatOptions = {
      notation: "auto", // 'auto', 'fixed', 'exponential' and "engineering"
      fraction: "decimal", //'ratio', 'decimal',
      precision: 99,
      lowerExp: -99,
      upperExp: 99
    }
let answer=bigmath.eval("1-2")
bigmath.format(answer, formatOptions)

You can try it here on codesanbox.

@josdejong
Copy link
Owner

Thanks for reporting @husayt! Fixed via 0721626 (will do a release within a few days)

@josdejong
Copy link
Owner

This should be fixed now in v5.4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants