Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2012 23:12:58 -0000
From:      Stephen Montgomery-Smith <stephen@missouri.edu>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        Diane Bruce <db@db.net>, 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:  <500A139D.2090803@missouri.edu>
Resent-Message-ID: <20120812231251.GW20453@server.rulingia.com>
In-Reply-To: <500A0DCF.4030707@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> <50097128.6030405@missouri.edu> <20120721032448.X5744@besplex.bde.org> <500A0DCF.4030707@missouri.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On 07/20/2012 09:02 PM, Stephen Montgomery-Smith wrote:
> Hey guys, I just found this paper:
>
> Implementing complex elementary functions using exception handling,
> T. E. Hull, Thomas F. Fairgrieve, Ping-Tak Peter Tang
> ACM Transactions on Mathematical Software, Volume 20 Issue 2, June 1994
> Pages 215-244
>
> http://dl.acm.org/citation.cfm?doid=178365.178404
>
> This includes an algorithm for clog.  Now that I have discovered just
> how hard it really is, I am going to read this paper.
>
> There is also a Corrigenda to this paper - the digital copy seems to be
> missing.  But I will try to retrieve the paper copy from my library.
>
> http://toms.acm.org/cgi/TOMSbibget.cgi?Anonymous:1994:C
>
> If anyone else wants a copy of these papers, I would be glad to share
> it.  But I am using the University of Missouri subscription to ACM, and
> I don't want to abuse it by sharing the paper willy-nilly.

Ugh.

The way they handle the real part of clog(z), log(hypot(x,y)), when 
hypot(x,y) is close to 1, is to do the calculation in double precision. 
  So to do it properly, we need a double double precision arithmetic, 
which we don't have.

They say it can be simulated, and I think I have seen quad-precision 
packages (I think it might even be included in FreeBSD ports).  But I am 
not so sure if we want to introduce quad precision into base FreeBSD. 
The paper says that simulating double precision arithmetic using single 
arithmetic is slow, so I would think the same is true for quad-precision.



Another thing - all their algorithms use exception handling.  That is, 
you go through the steps of the calculation, and if the FPU gives an 
overflow or underflow error, the program catches it, and then it does 
something else special.  So I guess the programs would have to save the 
state of the SIGFPE signal, set its own handler, and then restore the 
SIGFPE signal at the end.  And then the program has to keep track of 
SIGFPE signals it really wanted to send outside of itself, and then 
trigger those.

Does the inexact flag also raise the SIGFPE signal?

I can see how to avoid using exception handling, and they mention this 
in their papers, but they say it isn't clean.




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