5 ms·
My understanding is that you are correct. I believe that BigDecimal.doubleValue() does the conversion by (wait for it…) converting to a string and parsing with
by jonshea 16y ago
My understanding is that you are correct. I believe that BigDecimal.doubleValue() does the conversion by (wait for it…) converting to a string and parsing with Double.parseDouble(). Real quick:
scala> val y
y: java.math.BigDecimal = 2.2250738585072012E-308
scala> y.doubleValue()
Hangs
This is one of those “harder than it looks” problems.
- headius 16y agoYeah, I went back to my code and realized there was a precision problem I had to fix for numbers approaching 64-bit minimum. Once I fixed that issue, it went back to hanging again :( I updated the post, and I'm looking for new alternatives now.
- fedd 16y agomaybe its okay to lose some precision as everybody knows that doubles are already inaccurate? :) http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems http://en.wikipedia.org/wiki/Floating_point#Accuracy_problem...
- fedd 16y agoedit: i mean: normalize(!), check if it is textually the bad magic number, then either use builtin conversion or use your solution. a? :)