Java – maximum accuracy loss of double addition / subtraction at one time
•
Java
Is it possible to establish or even roughly explain the maximum precision loss when processing two double values in Java (plus / minus)? Perhaps the worst-case scenario is that two numbers cannot be accurately represented, and then operations are performed on them, resulting in a value that cannot be accurately represented
Solution
Look at math ulp(double). The double precision ULP is the next highest Delta For example, if you add to a number and one is less than the ULP of the other, you know that the addition will not work If you multiply two doubles, you can multiply their ULPS to obtain the maximum error of the result
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码