Date: Thu, 20 Aug 2009 16:04:00 -0700 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: Peter Jeremy <peterjeremy@optushome.com.au>, freebsd-arch@FreeBSD.ORG Subject: Re: C99 Complex Math Functions Message-ID: <20090820230400.GA61066@troutmask.apl.washington.edu> In-Reply-To: <20090817201319.GA22437@zim.MIT.EDU> References: <20090815015947.GA4682@server.vk2pj.dyndns.org> <20090817201319.GA22437@zim.MIT.EDU>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 17, 2009 at 04:13:19PM -0400, David Schultz wrote: > On Sat, Aug 15, 2009, Peter Jeremy wrote: > > Hi David, > > > > I've recently had a requirement for the C99 complex math functions. > > I know you have been doing some work on implementing functions in > > complex.h and wonder what (if any) plans you have for implementing > > the rest of the C99 functions. > > Which ones do you need? > > They are on my todo list, but they're not a priority, and I'm > swamped right now, so don't hold your breath! Steve Kargle and > Bruce Evans also have some interest in this. > > Many of the functions can be fudged with some simple formulas that > you can look up. The simple formulas work great in most cases, > but often fail near asymptotes and for special cases (infinity, > NaN, underflow, etc.) In a private response to Peter, I directed him to NetBSD. NetBSD contains some/most(?)/all(?) of the simple formula implementations. I sent Peter the guts of ccosh as implemented by NetBSD (the simple formula) and the current version of ccosh that Bruce and I had written. The netbsd version is 15 lines (excluding the license). The bde+me version is 91 lines (excluding license and initial comment). To be fair, a large portion of those 91 lines are comments of the form /* * cosh(+-Inf + I NaN) = +Inf + I d(NaN). * * cosh(+-Inf +- I Inf) = +Inf + I dNaN. * The sign of Inf in the result is unspecified. Choice = always +. * Raise the invalid floating-point exception. * * cosh(+-Inf + I y) = +Inf cos(y) +- I Inf sin(y) */ To be more fair, most of the comments with the above form are due to Bruce as well as the details of the implementation. PS: yes, I'll get around to completing the commit bit stuff one of these days. But, for now, I need to return to a report that is 6 weeks late and 2 proposals. -- Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090820230400.GA61066>