From #2915
I parameterize the mathjs like this :
const config: math.ConfigOptions = {
number: "Fraction",
};
const math: MathJsStatic = create(all, config);
I create units like this :
math.createUnit('rotation', {definition: '360 deg', aliases: ['tour','tr']})
I try to do this :
const a = math.unit(360, "deg");
const b = math.unit(1, "rotation");
expect(b.equals(a));
And i have this error :
TypeError: Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: 6.283185307179586). Use function fraction(x) to convert to Fraction.
Any idee ??!
tks.
Apparently the method Unit.equals internally tries to convert the Fraction into a number. For some reason the function math.equal(a, b) does work as expected whereas b.equals(a) throws this error.
It sounds like this is a solvable bug. Anyone able to look into this? Help would be welcome.