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

Adding support for a built-in Pi value? #5

Closed
jbranchaud opened this issue Apr 3, 2013 · 2 comments
Closed

Adding support for a built-in Pi value? #5

jbranchaud opened this issue Apr 3, 2013 · 2 comments

Comments

@jbranchaud
Copy link

I have started using bignumber.js for a project. I needed to do some math that involved the use of Pi in one of the equations. I had to construct a BigNumber for Pi myself and I wonder if it would make more sense to have this (and possibly other standard values) built-in?

Creating the Pi value wasn't straightforward either.

I tried BigNumber(Math.PI); but that gives an error because it has more than 15 significant digits.

This forced me to do something like BigNumber(Math.PI.toFixed(10));.

Seems like it would just be easier if we could do BigNumber.PI;.

@MikeMcl
Copy link
Owner

MikeMcl commented Apr 5, 2013

There will only be an error if a number type is passed, so BigNumber( Math.PI.toString() ) could be used.

It was tempting to include constants such as pi, but keeping the library lean (<= 5KB minified and gzipped) was a major goal.

I will shortly be releasing an extended version with a built-in parser which may include such.

Thanks for the feedback, and it will be further considered.

@MikeMcl MikeMcl closed this as completed Apr 5, 2013
@josdejong
Copy link

+1 for including a bignumber versions of pi and e.

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

No branches or pull requests

3 participants