I am trying to use such a hexadecimal floating constant "0x0.DAB789B" in java but it gives me java.lang.NumberFormatException. How can I convert hexadecimal float constant to decimal? I know how to convert hexadecimal int constant but that does not work for float constant.
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.
Question Answered as of 10 Months Ago by