From owner-cvs-src@FreeBSD.ORG Sat Apr 12 03:11:36 2008 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70880106566B; Sat, 12 Apr 2008 03:11:36 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 73B638FC12; Sat, 12 Apr 2008 03:11:36 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m3C3Ba90011107; Sat, 12 Apr 2008 03:11:36 GMT (envelope-from das@repoman.freebsd.org) Received: (from das@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m3C3BaFB011106; Sat, 12 Apr 2008 03:11:36 GMT (envelope-from das) Message-Id: <200804120311.m3C3BaFB011106@repoman.freebsd.org> From: David Schultz Date: Sat, 12 Apr 2008 03:11:36 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/lib/libc/gdtoa Makefile.inc _hdtoa.c _hldtoa.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Apr 2008 03:11:36 -0000 das 2008-04-12 03:11:36 UTC FreeBSD src repository Modified files: lib/libc/gdtoa Makefile.inc _hdtoa.c Added files: lib/libc/gdtoa _hldtoa.c Log: Make several changes to the way printf handles hex floating point (%a): 1. Previously, printing the number 1.0 could produce 0x1p+0, 0x2p-1, 0x4p-2, or 0x8p-3, depending on what happened to be convenient. This meant that printing a value as a double and printing the same value as a long double could produce different (but equivalent) results. The change is to always make the leading digit a 1, unless the number is 0. This solves the aforementioned problem and has several other advantages. 2. Use the FPU to do rounding. This is far simpler and more portable than manipulating the bits, and it fixes an obsure round-to-even bug. It also raises the exceptions now required by IEEE 754R. The drawbacks are that it is usually slightly slower, and it makes printf less effective as a debugging tool when the FPU is hosed (e.g., due to a buggy softfloat implementation). 3. On i386, twiddle the rounding precision so that (2) works properly for long doubles. 4. Make several simplifications that are now possible due to (2). 5. Split __hldtoa() into a separate file. Thanks to remko for access to a sparc64 box for testing. Revision Changes Path 1.10 +1 -1 src/lib/libc/gdtoa/Makefile.inc 1.6 +31 -208 src/lib/libc/gdtoa/_hdtoa.c 1.1 +176 -0 src/lib/libc/gdtoa/_hldtoa.c (new)