From owner-freebsd-standards Sat Mar 8 1:22:35 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 E0F2937B401; Sat, 8 Mar 2003 01:22:33 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id D903E43FBF; Sat, 8 Mar 2003 01:22:31 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id UAA14637; Sat, 8 Mar 2003 20:22:29 +1100 Date: Sat, 8 Mar 2003 20:22:28 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: David Schultz Cc: standards@FreeBSD.ORG, Subject: Re: gdtoa import this weekend, future directions In-Reply-To: <20030307063415.GA60214@HAL9000.homeunix.com> Message-ID: <20030308201519.X9873-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 On Thu, 6 Mar 2003, David Schultz wrote: > 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. Looks good (I didn't look at any details). > 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. I wouldn't change or reduce gdtoa's interfaces except as necessary to prevent references to the parts that we need (mainly strtold() and printf/scanf support) dragging in the whole library. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message