Java %(mod) with float and double
How can the balance of the two separations be obtained
doubleprimitives? If I use a standard function
%(mod)She's been working incorrectly from time to time (because of the specifics of the floating point, the mantis is missing), but I need accurate results. Is there such a function in the java bag?
If you do,
d % 0.1 == 0.00000000001- it's not the operator's fault.
%a comparison operator. You can never compare numbers with a floating point to strict equality!
That's how it works.
if (d % 0.1 < eps || d % 0.1 > 0.1 - eps) ...
eps- it's the absolute precision you need. For example,