Giter VIP home page Giter VIP logo

Comments (2)

MikeMcl avatar MikeMcl commented on June 12, 2024

Hello
I'm not looking to add a pi calculation function to the library at this point, but some visitors may find it useful.
I tried it out and it seems to work okay apart from the fact that the last digit is sometimes incorrect, e.g. with pi(1) and pi(100).
To avoid this the DECIMAL_PLACES value could be increased to say digits + 2 for the calculation and then sum could be round to digits before its return.
I am not clear why you are storing and setting all the config properties, surely it's only the DECIMAL_PLACES value that needs to be stored, set and then restored.
Also, it looks like you are using the Machin formula and there are others that are considerably faster, for example see http://beej.us/blog/data/pi-chudnovsky-gmp/.

from bignumber.js.

Xotic750 avatar Xotic750 commented on June 12, 2024

I was storing and restoring because in some of the testing I was changing
these and found that if you change the rounding scheme then it causes the
PI calculation to go into an infinite loop. I haven't fully checked as to
why yet, just wanted to see if it would of any interest wrt the library.
The last digit is being rounded and perhaps it should be truncated instead,
something I will need to think about a little. I will take a look at the
link, thanks.

On 16 September 2013 21:04, Michael Mclaughlin [email protected]:

Hello
I'm not looking to add a pi calculation function to the library at this
point, but some visitors may find it useful.
I tried it out and it seems to work okay apart from the fact that the last
digit is sometimes incorrect, e.g. with pi(1) and pi(100).
To avoid this the DECIMAL_PLACES value could be increased to say digits +
2 for the calculation and then sum could be round to digits before its
return.
I am not clear why you are storing and setting all the config properties,
surely it's only the DECIMAL_PLACES value that needs to be stored, set
and then restored.
It looks like you are using the Machin formula and there are others that
are considerably faster, for example see
http://beej.us/blog/data/pi-chudnovsky-gmp/.


Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-24535467
.

from bignumber.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.