Comments (8)
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.
+1
from bignumber.js.
See also the discussion at #17
from bignumber.js.
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.
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.
Would be nice to see the non-minified version. Hard to give feedback about the multi-constructor approach you mentioned.
from bignumber.js.
@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.
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)
- Using version 9.1.1, run new BigNumber(0).exponentiatedBy('-12345678901234567890123456789012345678901234567890').valueOf() Is return to infinity normal? HOT 1
- Issue toNumber() function round up when number is too big (v9.1.1) HOT 2
- Division on exponential values leads to infinite loop HOT 3
- 负数加减乘除不好用 HOT 1
- [Feature Request]: Can we support `toBigInt`?
- Type error HOT 2
- Big Number (toFixed,dp,decimalPlaces,toFormat) - Chrome Update Issue 115.0.5790.102 HOT 24
- Minus sign in formatted strings HOT 2
- wrong calculation result on multipliedBy/times methods HOT 1
- toNumber does not respect ROUNDING_MODE HOT 11
- Calculation error HOT 1
- Is there any other way to handle new BigNumber(999999999999999999999) without using strings? HOT 2
- Difference between multipliedBy and dividedBy behaviors HOT 2
- Different result between toFixed and toNumber HOT 1
- Can't convert to Base64 HOT 1
- Tree shake commonjs version from mjs version HOT 1
- toFixed error
- [Bug] Return Type of Methods HOT 1
- Logarithms (I know there is another issue about this)
- toString() default base is not 10? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bignumber.js.