-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
I'm a little bit confused on when the configuration actually is used.
This is my config
// create a mathjs instance with configuration
const config = {
number: 'BigNumber',
precision: 64,
}
const mathjs = create(all, config)
My calculation is as follows x / a * b
Where as
x = 4799
a = 40
b = 44
// 52798.899999999994
console.log('normal js', 4799 / 40 * 44);
// 52798.899999999994 <- I've read in the docs that number from configs is ignored here
console.log('mathjs functions', mathjs.multiply((mathjs.divide(x, a)), b))
// 52798.9 <- this I want all the time
console.log('mathJS evaluate', mathjs.evaluate(`47999 / 40 * 44`));
// 52798.899999999994 <- why is BigNumber ignored?
console.log('mathJS evaluate scope', mathjs.evaluate('x / a * b', {
x: 47999,
a: 40,
b: 44,
}));
Expected behaviour:
evaluate(expression, scope) should be the same as evaluate(expression))
Installed version 6.2.5
Reactions are currently unavailable