P in constant declaration

后端 未结 4 1836
醉话见心
醉话见心 2020-12-09 01:46

In java.lang.Double, there are the following constant declarations:

public static final double MAX_VALUE = 0x1.fffffffffffffP+1023;
public stati         


        
4条回答
  •  既然无缘
    2020-12-09 02:20

    It's used to signify a hexadecimal floating point literal.

    A floating-point literal has the following parts: a whole-number part, a decimal or hexadecimal point (represented by an ASCII period character), a fractional part, an exponent, and a type suffix. A floating point number may be written either as a decimal value or as a hexadecimal value. For decimal literals, the exponent, if present, is indicated by the ASCII letter e or E followed by an optionally signed integer. For hexadecimal literals, the exponent is always required and is indicated by the ASCII letter p or P followed by an optionally signed integer.

    From http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#230798

提交回复
热议问题