Coder Social home page Coder Social logo

Comments (8)

MikeMcl avatar MikeMcl commented on July 20, 2024

No, you're right!

A new release is imminent that will allow the precision and rounding mode to be set for individual operations, and also for multiple instances of the BigNumber constructor itself.

from bignumber.js.

Xotic750 avatar Xotic750 commented on July 20, 2024

+1

from bignumber.js.

josdejong avatar josdejong commented on July 20, 2024

See also the discussion at #17

from bignumber.js.

MikeMcl avatar MikeMcl commented on July 20, 2024

I have posted a preview of bignumber.js v2 as a jsfiddle here.

It includes new functionality such as support for non-integer powers, and has log, exp, and ln methods (although performance degrades quickly with increasing digits, particularly for pow). It also greatly increases the maximum exponent magnitude and allows the precision of operations to be specified in significant digits instead of decimal places. The precision and a min/max sd/dp can also be specified for each individual operation.

Multiple instances of the BigNumber constructor can also be created.

Perhaps vekexasia was referring to specifying the precision and rounding mode for each actual number at the time of creation and although that would be a radical change it is something I am also considering as the multiple constructor approach isn't very memory efficient and it would help to sove the problem of adding and subtracting numbers with massively different exponents.

from bignumber.js.

josdejong avatar josdejong commented on July 20, 2024

That's great news! I'm really happy to hear that we can specify a number of significant digits, and the support for log and exp is great! (And that means that we also have the constant e :) ).

from bignumber.js.

Xotic750 avatar Xotic750 commented on July 20, 2024

Would be nice to see the non-minified version. Hard to give feedback about the multi-constructor approach you mentioned.

from bignumber.js.

ahansen1 avatar ahansen1 commented on July 20, 2024

@MikeMcl I also need the rounding configurable more granular than globally, either per instance or the factory approach mentioned in #17 would work. I see the v2 preview, but am not finding this code in Git. Is there code in Git that will allow for per instance rounding configuration?

Should this issue be re-opened and marked as a feature request so others may easily find it vs. having to look at the closed issues.

from bignumber.js.

MikeMcl avatar MikeMcl commented on July 20, 2024

@ahansen1

I intend to provide per instance configuration, but it will be instance of BigNumber constructor, not instance of BigNumber, if you follow me. I.e. it will be the same approach I have used in decimal.js. Contrary to what I stated above, this multiple constructor approach is now memory efficient.

I estimate it will be another month before it will be ready for publication, as I am using the time I have available at the moment on a major update to decimal.js. If that is too long, you could try decimal.js or even email me to offer an incentive to meet your preferred time scale.

The v2 preview I linked to above will not now be how v2 is going to be, and it is not production-ready and may not be reliable.

I have marked this issue as a feature request.

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.