Details
-
Bug
-
Status: Resolved
-
Trivial
-
Resolution: Fixed
-
3.12.0
-
None
Description
This currently fails:
assertEquals(Float.valueOf(0), NumberUtils.createNumber("0F")); assertEquals(Double.valueOf(0), NumberUtils.createNumber("0D"));
This passes:
assertEquals(Float.valueOf(0), NumberUtils.createNumber("0.F")); assertEquals(Double.valueOf(0), NumberUtils.createNumber("0.D")); assertEquals(Float.valueOf(0), NumberUtils.createNumber("0e0F")); assertEquals(Double.valueOf(0), NumberUtils.createNumber("0e0D"));
This is due to the incorrect extraction of the mantissa for a floating point value when there is no exponent or decimal place as it includes the trailing format specifier (F or D). The input string is then not detected as being all zeros and the returned type is BigDecimal.