Floating Point Arithmetic - Modulo Operator on Double Type
- by CrimsonX
So I'm trying to figure out why the modulo operator is returning such a large unusual value.
If I have the code:
double result = 1.0d % 0.1d;
it will give a result of 0.09999999999999995. I would expect a value of 0
Note this problem doesn't exist using the dividing operator -
double result = 1.0d / 0.1d;
will give a result of 10.0,…