Date: Thu, 6 Mar 2003 22:34:15 -0800 From: David Schultz <das@FreeBSD.ORG> To: standards@FreeBSD.ORG Cc: obrien@FreeBSD.ORG Subject: gdtoa import this weekend, future directions Message-ID: <20030307063415.GA60214@HAL9000.homeunix.com> In-Reply-To: <20030221085508.GA55786@HAL9000.homeunix.com> References: <20030221085508.GA55786@HAL9000.homeunix.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030307063415.GA60214>