From owner-freebsd-standards Thu Mar 6 22:34:23 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2B07A37B401; Thu, 6 Mar 2003 22:34:22 -0800 (PST) Received: from HAL9000.homeunix.com (12-233-57-224.client.attbi.com [12.233.57.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E80043FCB; Thu, 6 Mar 2003 22:34:21 -0800 (PST) (envelope-from das@FreeBSD.ORG) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id h276YFLT060517; Thu, 6 Mar 2003 22:34:15 -0800 (PST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id h276YFdH060516; Thu, 6 Mar 2003 22:34:15 -0800 (PST) (envelope-from das@FreeBSD.ORG) Date: Thu, 6 Mar 2003 22:34:15 -0800 From: David Schultz To: standards@FreeBSD.ORG Cc: obrien@FreeBSD.ORG Subject: gdtoa import this weekend, future directions Message-ID: <20030307063415.GA60214@HAL9000.homeunix.com> Mail-Followup-To: standards@FreeBSD.ORG, obrien@FreeBSD.ORG References: <20030221085508.GA55786@HAL9000.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030221085508.GA55786@HAL9000.homeunix.com> Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This took me longer than expected due to obscure bugs in the vendor source, but I've finally pulled everything together. To recap, gdtoa is a library for string->float and float->string conversion. Our libc presently uses its predecessor from 3BSD, which lacks support for hexadecimal floating point constants, floats, and long doubles. I'd like to do the import this weekend. I've tested extensively on i386, and I've verified buildworlds and basic functionality on ia64 and sparc64. I do not plan to immediately integrate long double support into printf because there are multiple outstanding bugs in our printf implementation's floating point support, and I haven't decided whether to repair or replace yet. As it is, my test cases are crashing in printf on ia64 without any of my changes. The initial import will only add strtof() and strtold() and the associated documentation. As per Garret's suggestion, I would like to soon add some interfaces that are not standardized, but perhaps not all of the features gdtoa provides. (In particular, strtor{f,d,ld} can be emulated by setting the rounding direction before calling the standard functions, so maybe we don't need to bother with those for now.) I would like to add: int strtofi(const char *nptr, char **endptr, float *lo, float *hi); int strtodi(const char *nptr, char **endptr, double *lo, double *hi); int strtoldi(const char *nptr, char **endptr, long double *lo, long double *hi); These routines are like strtod(), but they efficiently compute two floating point numbers that tightly bound the actual value of the parsed string. The vendor implementation returns an integer constant that classifies the number as zero, normal, NaN, etc. Since we already have fpclassify() and a separate set of manifest constants for that, I suggest defining the return value of our version to be zero if the converted value can be represented exactly (in which case 'hi' is also zero) and nonzero otherwise. (I have chosen different function names to reflect that.) Alternatively, we could just add more manifest constants and use the vendor's version. Comments and suggestions are appreciated. The code is in http://www.FreeBSD.ORG/~das/gdtoa/ . The files are described below: gdtoa.tgz latest vendor source; will appear on the netlib mirrors within a few days gdtoa.diff patches against vendor source libc_gdtoa.diff patches against the rest of the tree: do a 'mkdir lib/libc/{gdtoa,powerpc/stdlib}' first To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message