From owner-freebsd-current@FreeBSD.ORG Mon Jul 9 03:05:05 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 51FC61065676 for ; Mon, 9 Jul 2012 03:05:05 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id 22A408FC0A for ; Mon, 9 Jul 2012 03:05:05 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id q693545I054256; Sun, 8 Jul 2012 20:05:04 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id q69354cJ054255; Sun, 8 Jul 2012 20:05:04 -0700 (PDT) (envelope-from sgk) Date: Sun, 8 Jul 2012 20:05:04 -0700 From: Steve Kargl To: Warner Losh Message-ID: <20120709030504.GA54131@troutmask.apl.washington.edu> References: <20120529000756.GA77386@troutmask.apl.washington.edu> <4FC43C8F.5090509@missouri.edu> <20120529045612.GB4445@server.rulingia.com> <20120708124047.GA44061@zim.MIT.EDU> <210816F0-7ED7-4481-ABFF-C94A700A3EA0@bsdimp.com> <4FF9DA46.2010502@missouri.edu> <20120708235848.GB53462@troutmask.apl.washington.edu> <4FFA25EA.5090705@missouri.edu> <20120709020107.GA53977@troutmask.apl.washington.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: Stephen Montgomery-Smith , freebsd-current@freebsd.org Subject: Re: Use of C99 extra long double math functions after r236148 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2012 03:05:05 -0000 On Sun, Jul 08, 2012 at 08:13:21PM -0600, Warner Losh wrote: > > On Jul 8, 2012, at 8:01 PM, Steve Kargl wrote: > > Not to mention, I've seen way too many examples of 'x - y' > > where cancellation of significant digits causes > > problems. Throw in rather poor estimates of function > > results with real poor ULP and you have problems. > > Are these problems significantly more or less than the > usual #define I talked about before? If the functions > are so so, but much better than the double version, we > have a significant win, even if things aren't perfect. The answer is more complicated than the question asked. On i386, the precision of long double and double is 53 bits. On amd64, the precision of long double and double are 64 and 53 bits. On i386 and amd64, emax and emin are 1024 and -1023 (could be off by one here) for double and 16384 and -16383 for long double. Now, consider 2**emin <= exp(x) <= 2**emax for some set of x (where I'm using the Fortran exponential operator ** instead of powl(2,{emin|emax}) because FreeBSD does not have a powl()). The sets for long double and double are significantly different. > If we weren't 13 past the publication date of the c99 standard, > I'd be more sympathetic to the 'we need a high quality > implementation' arguments. However, we can't let the perfect > be the enemy of the good here. We claim c99 conformance, yet > don't have these functions. AFAIK, neither gcc in base nor clang would be c99 complaint even if all of the c99 math functions were available. > After all, many of the original functions that were in our > library had sub-optimial performance which bruce optimized > over many years. Why can't we use this model here? I think the fear is that committing sub-optimal code would take many many more years to fix. AFAICT, bde longer commits code to src/ (since the switch from cvs to svn), and he depends on his code reviews to get things fixed. With das and me both having little to no time for FreeBSD, that leaves no one to review/commit his suggested fixes (not that I would question bde's opinion on a code change). -- Steve