[PATCH] Fix lrint, lrintf bugs

Jeff Johnston jjohnstn@redhat.com
Mon Jun 27 19:44:00 GMT 2005


Dave Korn wrote:
> ----Original Message----
> 
>>From: Dave Korn
>>Sent: 26 June 2005 17:09
> 
> 
>>----Original Message----
>>
>>>From: Dave Korn
>>>Sent: 26 June 2005 16:56
>>
>>>----Original Message----
>>>
>>>>From: Dave Korn
>>>>Sent: 26 June 2005 16:25
>>>
>>>>  Um.  If I'm brutally honest I suppose I should point out that the
>>>>testing doesn't cover very large values.  I'll do that offline after I
>>>>send this post.  In the meantime, assume this is good unless I report
>>>>back it went wrong!
>>>
>>>
>>>  :)  It went right!
>>>
>>
>>  For reference, here's the improved testcase I used with big nums, and it
>>also uses long ints instead of recycling the float/double vars to receive
>>the function results.  Still no discrepancies.
>>
> 
> 
> 
>   Oh, and as CV has pointed out, one of these might be needed:
> 
> 
> 2005-06-26  Dave Korn  <dave.korn@artimi.com>
> 
> 	* libm/common/s_lrint.c (lrint):  Fix signed-vs-unsigned comparison
> 	and miscalculation caused by fp representation of zero.
> 	* libm/common/sf_lrint.c (lrintf):  Likewise.
> 
> 
> 
>     cheers,
>       DaveK

Thanks Dave.  I see the 2nd check for 0 in lrint as being extraneous. 
There is no way that adding a value to 2**52 that has an exponent >= 20 
and less than 8 * sizeof int can result in 0.    Ok if I remove that and 
check it in?

-- Jeff J.



More information about the Newlib mailing list