JLS 3.10.2 -- Exposition of hexadecimal f.p. literals

Alex Buckley alex.buckley at oracle.com
Fri Oct 18 18:28:38 UTC 2019


The following issue was raised on the java-se-spec-comments list:

https://mail.openjdk.java.net/pipermail/java-se-spec-comments/2019-October/000003.html

-----
In 3.10.2, Floating-Point Literals, hexadecimal floating-point literals 
are poorly explained. It is not mentioned that the "binary exponent" 
part is in base 2 instead of the decimal floating-point exponent base 
10. An example would be useful. Something like "0xFFp1 = 510.0".

It is also somewhat unclear if hexadecimal floating-point literals are 
double- or single-precision by default. The first text paragraph of page 
36 could clear this up if changed from "A floating-point literal is of 
type float [...]" to "A floating-point literal (decimal or hexadecimal) 
is of type float [...]".

The values for the largest/smallest positive finite non-zero 
float/double literals should also be given in hexadecimal notation and 
include mention of the predefined constants MIN_VALUE and MAX_VALUE of 
the Float and Double classes.

Finally, on page 37 the reference to "a non-zero denormalized number" 
should add "(see 4.2.3)".
-----

These are largely issues of editorial clarity, not correctness. I defer 
to Joe Darcy to decide whether, 15 years after hexadecimal f.p. literals 
were added to the JLS (Third Edition, for Java SE 5), it is worth trying 
to incorporate/update material from 
https://blogs.oracle.com/darcy/hexadecimal-floating-point-literals into 
JLS 3.10.2.

Alex


More information about the jls-jvms-spec-comments mailing list