Open nycos62 opened 3 months ago
That is an interesting one. The relTol
and absTol
values need to be numbers, and a regular Javascript number
can "only" hold an exponent up to about 300, so this limits the number of digits we can handle.
So, using a relTol
and absTol
in the order of 300 will still work:
math.config({
number: "BigNumber", // Default type of number:
// 'number' (default), 'BigNumber', or 'Fraction'
precision: 309, // Number of significant digits for BigNumbers
relTol: 1e-300,
absTol: 1e-303
});
math.floor(math.multiply(math.pi, math.pow(math.bignumber(10),math.bignumber(60)))).toFixed()
// "3141592653589793238462643383279502884197169399375105820974944" (as expected)
To address this, I think we can either implement support for relTol
and absTol
to be a BigNumber, or change them to only note the number of digits (like 300
) instead of the value 1e-300
.
Hello, I don't know well if it's an issue or if I'm doing something wrong : (math.js version 13.0.3)
and then because of relTol of 1e-60 when you floor it it send a wrong result :
what should I do to get correct number ? i tried this :
but it convert then 1e-503 to 0 and then get this error (because relTol = 0 then)
thank you :)