String Working with string representations of floating point values can lead to produce incorrect conclusions about the precision of the values. For example, consider converting the conversion of a value of from type float
to the type double
, a widening primitive conversion. Refer to the guideline FLP10-J. Do not cast primitive integer types to floating-point types without range checks for more details about such conversions.
String representations of floating-point numbers shall not be compared or inspected. When the value of the a float
variable must be represented exactly using the double
type, an explicit assignment is more appropriate than first converting the floating point value to a String
and then to a double
.
...