From owner-freebsd-arch@FreeBSD.ORG Thu Aug 20 23:04:01 2009 Return-Path: Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EA2F106568E for ; Thu, 20 Aug 2009 23:04:01 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id 31FE18FC16 for ; Thu, 20 Aug 2009 23:04:01 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.3/8.14.3) with ESMTP id n7KN40ZJ061188; Thu, 20 Aug 2009 16:04:00 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.3/8.14.3/Submit) id n7KN40jb061187; Thu, 20 Aug 2009 16:04:00 -0700 (PDT) (envelope-from sgk) Date: Thu, 20 Aug 2009 16:04:00 -0700 From: Steve Kargl To: Peter Jeremy , freebsd-arch@FreeBSD.ORG Message-ID: <20090820230400.GA61066@troutmask.apl.washington.edu> References: <20090815015947.GA4682@server.vk2pj.dyndns.org> <20090817201319.GA22437@zim.MIT.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090817201319.GA22437@zim.MIT.EDU> User-Agent: Mutt/1.4.2.3i Cc: Subject: Re: C99 Complex Math Functions X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2009 23:04:01 -0000 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