You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tests succeed when a BigDenary is converted to number with valueOf(), because valueOf() internally convert to string and then uses parseFloat() for the conversion to number, and because the converted string has more than 14 decimals, the returned number is rounded.
I decided then to test also decimal.js and number object, and I found that: number process them correctly (failing on others) while decimal.js fails at them as this library.
Test file attached.
For completeness, I also tested C #, and using the decimal type the problem is not present:
Hi,
I found an issue I want to highlight, curious about the position of the maintainer of this library on it.
I found that for bigdenary
(100 / 3) * 3 != 100
and(100 / 3) + (100 / 3) + (100 / 3) != 100
the failing test are the following
The tests succeed when a BigDenary is converted to number with
valueOf()
, becausevalueOf()
internally convert to string and then usesparseFloat()
for the conversion to number, and because the converted string has more than 14 decimals, the returned number is rounded.I decided then to test also decimal.js and
number
object, and I found that:number
process them correctly (failing on others) whiledecimal.js
fails at them as this library.Test file attached.
For completeness, I also tested C #, and using the
decimal
type the problem is not present:test.txt
The text was updated successfully, but these errors were encountered: