Use of C99 extra long double math functions after r236148

Stephen Montgomery-Smith stephen at missouri.edu
Sun Aug 12 23:09:23 UTC 2012


On 07/19/2012 06:16 AM, Bruce Evans wrote:
> On Thu, 19 Jul 2012, Stephen Montgomery-Smith wrote:
>
>> I did a ULP test on clog.  The test code is attached.  (Not the
>> cleanest code, I know, but it does the job.)  It needs the mpfr and
>> unuran ports installed.
>>
>> To my shock, I found that under certain circumstances, the ULP in the
>> real part was huge.  The problem is when hypot(x,y) is close to 1,
>> because then the real part of clog is close to zero.  I was seeing
>> ULPs in the thousands.
>
> Better than GULPs in the thousands :-).
>
> This is not the problem that I first thought it might be.
>
>> I struggled to find a solution, and now I think I have the ULP down to
>> about 2.  I am going to work on it more tomorrow to see if I can get
>> ULP down even further.

I have the ULP down to about 1.2 now.  I don't see how I can do better, 
because I have to invoke log functions twice, and probably each one has 
a ULP of about 0.6.

Also I decided to use 1/2 log(x*x+y*y) when x and y are not too large.

I am really rather proud of how I got around the large ULP when 
hypot(x,y) is close to 1.  I would be glad if any of you could look at 
the code when you get a chance.

Also, now that I see how hard clog was, I have more appreciation of 
Steve's objections.



More information about the freebsd-numerics mailing list