Alright, I've been programming in Java for the better part of three years, now, and consider myself very experienced. However, while looking over the Java SE source code, I ran into something I didn't expect:
in class
Double
:
public static final double MIN_NORMAL = 0x1.0p-1022; // 2.2250738585072014E-308
public static final double MIN_VALUE = 0x0.0000000000001P-1022; // 4.9e-324
I did not expect this and can't find out what it means. If you don't know, I'm referring to the p
and P
that are after these numbers, before the subtraction operator. I know you can use suffixes to force a number to be a double
, long
, float
, etc., but I've never encountered a p
or P
. I checked the Java API, but it doesn't mention it. Is there a complete list of Java primitive number literal modifiers somewhere? Does anyone know them all?
For reference, below are the ones I've used or encountered, with the ones whose purposes elude me in bold with question marks (#
represents any arbitrary number within respective limits):
Suffixes:
#
= 32-bit integerint
#L
= 64-bit integerlong
#l
= another 64-bit integerl
?#f
= 32-bit floating-pointfloat
#F
= another 32-bit floating-pointfloat
?#d
= 64-bit floating-pointdouble
#D
= another 64-bit floating-pointdouble
?#e#
= scientific notation#E#
= another scientific notation?#p
= ?#P
= ?- Any more?
Prefixes:
0b#
= binary (base 2) literal0B#
= another binary (base 2) literal?0#
= octal (base 8) literal#
= decimal (base 10) literal0x#
= hexadecimal (base 16) literal0X#
= another hexadecimal (base 16) literal?- Any more?
Other (are there suffixes or prefixes for these?):
(byte)#
= 8-bit integerbyte
(short)#
= 16-bit integershort
(char)#
- 32-bit characterchar