Working Around the Java Double.parseDouble Bug
blog.headius.com
blog.headius.com
A bug report for the same bug from almost 10 (ten!) years ago: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4421494
State 5-Cause Known, bug Priority: 4-Low
return base.scaleByPowerOfTen(exponent).doubleValue();In any case, for the original value and variations I tested, the workaround does function properly.
scala> val y y: java.math.BigDecimal = 2.2250738585072012E-308
scala> y.doubleValue() Hangs
This is one of those “harder than it looks” problems.
I updated the post, and I'm looking for new alternatives now.
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problem...
at least, just check the input hash against a hashcode[1] of "2.2250738585072012e-308" and then call either custom function or the native one.
normalizing, parseInt, cunstructing a bigDecimal may be a bit more expencive than the native func (don't know for sure)
(and did anyone check whether it hangs on French (?) locale where there is a decimal comma, not dot?)
[1] two hashcodes, with small and big "E"