Date: Sat, 8 Mar 2003 20:22:28 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: David Schultz <das@FreeBSD.ORG> Cc: standards@FreeBSD.ORG, <obrien@FreeBSD.ORG> Subject: Re: gdtoa import this weekend, future directions Message-ID: <20030308201519.X9873-100000@gamplex.bde.org> In-Reply-To: <20030307063415.GA60214@HAL9000.homeunix.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030308201519.X9873-100000>