iriscouch / bigdecimal.js Goto Github PK
View Code? Open in Web Editor NEWArbitrary-precision Javascript BigInteger and BigDecimal real numbers
License: Apache License 2.0
Arbitrary-precision Javascript BigInteger and BigDecimal real numbers
License: Apache License 2.0
Is this module maintained or not? I see old bug reports and no commits for two years.
When trying to build this as per the readme's instructions, I get:
mscdex@server:~/iriscouch-bigdecimal.js-5ee98b5$ rake
RoundingMode.java.erb => RoundingMode.java
MathContext.java.erb => MathContext.java
BigInteger.java.erb => BigInteger.java
rake aborted!
compile error
(erb):38: syntax error, unexpected ')'
).to_s); _erbout.concat "\n ...
^
Tasks: TOP => default => bigdecimal => /home/mscdex/iriscouch-bigdecimal.js-5ee98b5/lib/bigdecimal.js => /home/mscdex/iriscouch-bigdecimal.js-5ee98b5/build/out.js => /home/mscdex/iriscouch-bigdecimal.js-5ee98b5/BigDecimalApp/src/com/iriscouch/gwtapp/client/BigDecimal.java
(See full trace by running task with --trace)
Any ideas?
negative zero is a result of "compareTo"
Hi,
Is it possible to use the magnitude constructor from the Java BigInteger?
BigInteger(int signum, byte[] magnitude)
I got errors about "function with number array arguments" not existing.
Hi, using both nodejs and in the browser (firefox and chrome), I'm not getting the expected result for compareTo of 'equal' values, one with trailing zeros.
I thought compareTo ignored scale? Maybe I'm missing something though?
For now I'm adding .stripTrailingZeros() for each side of compareTo calls as a workaround.
Example:
var BD = require("bigdecimal");
var a=BD.BigDecimal('0.09');
var b=a.setScale(4);
console.log(a.compareTo(b)); // returns 1 (expected 0)
var a=BD.BigDecimal('0.091');
var b=BD.BigDecimal('0.0910000');
console.log(a.compareTo(b)); // returns 1 (expected 0)
it's from java.math, but i need to use it in the bigdecimal class.
var currencyContext = new bigdecimal.MathContext(2)
TypeError: Object 2 has no method 'gC'
For example, a%b
?
Hello,
I tried to use your library and found issue in IE8. As I understand this issue is the same as described here http://stackoverflow.com/questions/9043648/bigdecimal-javascript-library
It would be great if this library will work independent from browser engine.
I'm seeing any issues when I add custom functions to Array.prototype while using the BigDecimal.js library.
Specifically it fails with a traceback to line 295:
function mb(b){return function(){try{return nb(b,this,arguments)}catch(a){throw a}}}
with this exception:
Uncaught java.lang.RuntimeException: Unknown call signature for obj = new java.math.BigDecimal: string function
I've tried multiple function names and it doesn't appear to be a naming collision, it just seems to be checking the methods on Array.prototype and failing for some reason if there are nonstandard methods.
Based on the Java documentation, my expectation is that these two lines would result in the same value:
new BigDecimal(0.615000001).setScale(2, BigDecimal.ROUND_HALF_UP).toString() // => "0.62"
new BigDecimal(0.615).setScale(2, BigDecimal.ROUND_HALF_UP).toString() // => "0.61"
Can we combine ints and decs in calculations?
for example, the following.
var a = b.BigDecimal('123456.123456789012345678901234567890');
var b = b.BigInteger(123456123456789012345678901234567890);
var result = a.multiply(b);
Is that allowed?
Can you add instructions for browser usage?
If you make a prod build of Angular 6 you will see such error
vendor.1248eb8e9cd17359ec51.js:1 ERROR et {f: "Unknown call signature for obj = new java.math.BigDecimal: object"}
In dev build - all is ok
How can I resolve it ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.