Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2012 23:10:45 -0000
From:      Bruce Evans <brde@optusnet.com.au>
To:        Stephen Montgomery-Smith <stephen@missouri.edu>
Cc:        Diane Bruce <db@db.net>, Bruce Evans <brde@optusnet.com.au>, John Baldwin <jhb@freebsd.org>, David Chisnall <theraven@freebsd.org>, Bruce Evans <bde@freebsd.org>, Steve Kargl <sgk@troutmask.apl.washington.edu>, David Schultz <das@freebsd.org>, Peter Jeremy <peter@rulingia.com>, Warner Losh <imp@bsdimp.com>
Subject:   Re: Use of C99 extra long double math functions after r236148
Message-ID:  <20120723131233.U1189@besplex.bde.org>
Resent-Message-ID: <20120812231038.GA20453@server.rulingia.com>
In-Reply-To: <500C5EE5.4090602@missouri.edu>
References:  <20120714120432.GA70706@server.rulingia.com> <20120717084457.U3890@besplex.bde.org> <5004A5C7.1040405@missouri.edu> <5004DEA9.1050001@missouri.edu> <20120717200931.U6624@besplex.bde.org> <5006D13D.2080702@missouri.edu> <20120718205625.GA409@troutmask.apl.washington.edu> <500725F2.7060603@missouri.edu> <20120719025345.GA1376@troutmask.apl.washington.edu> <50077987.1080307@missouri.edu> <20120719032706.GA1558@troutmask.apl.washington.edu> <5007826D.7060806@missouri.edu> <5007AD41.9070000@missouri.edu> <20120719205347.T2601@besplex.bde.org> <50084322.7020401@missouri.edu> <20120720035001.W4053@besplex.bde.org> <50085441.4090305@missouri.edu> <20120720162953.N2162@besplex.bde.org> <20120720184114.B2790@besplex.bde.org> <50095CDE.4050507@missouri.edu> <20120723044308.X6145@besplex.bde.org> <500C5EE5.4090602@missouri.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 22 Jul 2012, Stephen Montgomery-Smith wrote:

> But I will say that your latest version of clog doesn't do as well as mine 
> with this input:
>
>    x = unur_sample_cont(gen);
>    y = unur_sample_cont(gen);
>    h = hypot(x,y);
>    x = x/h;
>    y = y/h;
>
> I was able to get ULPs less than 2.  Your program gets ULPs more like up to 
> 4000.

I may have broken the double version when working mostly on the float
version recently.

What are the actual x and y?  I'm not set up to use mpfr.

Since the float version gets errors of 4096 ulps (12 bits wrong), the
double version is sure to get errors of [much more than] 12 + (53-24)
= 41 bits wrong.  That is 2 tera ulps.  Not noticing such enormous
errors indicates that the problematic cases haven't been tested.  I
think you are right that it needs more like tripled double precision
-- with merely doubled double precision, it can probably get all 53
mantissa bits and the sign bit wrong too (sign of (|z|^2 - 1)).  That
is total loss of precision (TLOSS), and should be handled by returning
NaN.  Sign errors are especially interesting with complex functions
and even for real log() applied to a real function, since they may
change the branch.  I got TLOSS including sign errors in the loghypotf()
result in intermediate version due to bugs in the doubling of float
precision.  Before the attempted doubling, TLOSS might have been the
usual case for z near 1!

> I have to say that I consider a ULP of 4000 under these very extreme 
> circumstances to be acceptable.  Definitely acceptable if the code goes a 
> whole lot faster than code that has a ULP of less than 2.

"An ULP of 4000" is unusual terminology.  An ulp is a unit, not a count.

I haven't figured out how to cut down the amount of mail generated by
this thread.  Sorry to add to it :-).

> On 07/22/2012 02:29 PM, Bruce Evans wrote:
>> Replying again to this...

Top posting is one way :-).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120723131233.U1189>