5 ms·
OpenJDK BigDecimal::doubleValue() goes via a string in certain situations https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/math/BigDe
by shellac 7y ago
OpenJDK BigDecimal::doubleValue() goes via a string in certain situations https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/math/BigDecimal.java#L3667 https://github.com/openjdk/jdk/blob/master/src/java.base/sha...
- SloopJon 7y agoI just ran into a similar booby trap the other day: whereas BigDecimal::BigDecimal(double) does the full decimal expansion, BigDecimal::valueOf(double) goes through Double::toString(double), which is generally a lot fewer digits.