Java are de-normalized numbers guarantied?

Viewed 131

Does the Java Standard impose anything about the exact behavior of floating points?

Is there any guaranty that it will use de-normalized numbers? There are the constants Float.MIN_VALUE and Float.MIN_NORMAL, but what happens when the hardware does not handle de-normalized numbers?

In a more concrete case, am I guarantied that on a x86/64 system that every java implementation does not disable de-normalized values?

Can I disable this behavior and consider all de-normalized numbers as zero?

1 Answers

The Java Language Specification section 4.2.4 requires support for denormalized numbers:

In particular, the Java programming language requires support of IEEE 754 denormalized floating-point numbers and gradual underflow, which make it easier to prove desirable properties of particular numerical algorithms. Floating-point operations do not "flush to zero" if the calculated result is a denormalized number.

If the hardware does not handle de-normalized numbers, this has to patched in software in the JVM for it to be compliant with the specification.

Related