Java dual epsilon

I currently need an epsilon of type double (constants in the Java library are preferred rather than their own implementation / definition)

Epsilon: the difference between 1 and the minimum value greater than 1 that the data type can represent

Solution

I assume you mean epsilon in the wrong sense of value This

If so, it is called ULP (last unit) in Java You can use Java Lang.math package and math The ULP () method finds it See JavaDocs here

This value will not be stored as a static member because it will vary depending on what you care about

Edit: according to the definition of OP, now in this problem, the double ULP with a value of 1.0 is 2.220446049250313e-16, which means double (that is, the return value of math.ulp (1.0))

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
分享
二维码
< <上一篇
下一篇>>