String representations of floating point values can lead to incorrect conclusions about the precision of the values. For example, consider converting a value of type float
to the type double
, a widening primitive conversion. Refer to the guideline FLP10-J. Avoid casting Do not cast primitive integer types to floating-point types without range checks for more details about such conversions. When the value of the 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
.
...