I am withdrawing this patch for the time being as properly the changes should 
also go into the fork sun.misc.FormattedFloatingDecimal. I'll post an updated 
patch once it is available.

Thanks,

Brian

On Feb 14, 2013, at 5:23 PM, Brian Burkhalter wrote:

> The patch below is as submitted to OpenJDK bugzilla but with enhanced 
> comments. It pertains to the correction loop in the doubleValue() method of 
> FloatingDecimal. The situation appears to arise when the candidate value is 
> less than 2*Double.MIN_NORMAL as for such values the ULP is less than 
> 2*Double.MIN_VALUE so that the intermediate result 0.5*ULP is less than 
> Double.MIN_VALUE which rounds to zero per FP-strict and the correction is 
> therefore zero. Thus the candidate value is unchanged. The fix is to add the 
> ULP to twice the candidate value, obtain the intermediate result, and then 
> halve it to obtain the adjusted candidate.
> 
> I am relatively new to IEEE-754 and this area of the code so any comments 
> would be appreciated.
> 
> Thanks,
> 
> Brian
> 
> diff -r 1405ad6afb1e -r 36482ed9bb7e 
> src/share/classes/sun/misc/FloatingDecimal.java
> --- a/src/share/classes/sun/misc/FloatingDecimal.java Thu Feb 14 11:09:07 
> 2013 -0800
> +++ b/src/share/classes/sun/misc/FloatingDecimal.java Thu Feb 14 16:47:53 
> 2013 -0800

Reply via email to