Subject: Re: PR 18803 - printf(3) does not handle long double
To: None <tech-userlevel@netbsd.org>
From: J.T. Conklin <jtc@acorntoolworks.com>
List: tech-userlevel
Date: 01/16/2005 15:51:57
I apologize this message won't be threaded properly.  I resubscribed
to the tech-userlevel list today, and found this recent topic on the
mailing list archive as I was catching up.

One option to consider is to update David M. Gay's floating point
conversion code found in libc/stdlib/strtod.c to his "generalized"
dtoa library (ftp.netlib.org/fp/gdtoa.tgz).

It will handle all the currently supported floating point formats,
plus 80 (x86), 96 (m68k), and 128 (sparc, etc.) bit IEEE extended
formats.

Like the older version, it performs conversions in floating point
where it can, falling back to multi-precision integer math where it
must.  I believe this means doubles, rather than extended precision;
so the issue of throwing everything into long double for conversion
leading to poor performance on systems that use emulated 128 bit FP
that was raised by Martin Husemann should not be a problem.

I've been browsing the FreeBSD CVS, and it looks like they made the
switch to gdtoa some time ago.

    --jtc

-- 
J.T. Conklin