Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java are de-normalized numbers guarantied?

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?

like image 623
Unlikus Avatar asked May 13 '26 19:05

Unlikus


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.

like image 65
Joni Avatar answered May 15 '26 07:05

Joni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!