long double (was "strtold?")
Howland Craig D (Craig)
howland@LGSInnovations.com
Wed Mar 11 11:57:00 GMT 2009
[This email has a new subject to branch off the "strtold?" email since
it
is asking some more general questions.]
Corinna:
I've been wondering about the general long double issue recently
because I was doing some preliminary work on adding some long double
functions to the math library. (I hadn't stumbled across ldtoa.c, yet,
so
it's interesting to learn of its existence.)
A question that I have had is, do long double functions need to
have a configure check for long double for conditional inclusion?
(I had gotten as far as finding out that configure has a built in check
for it and that AC_TYPE_LONG_DOUBLE can be used to generate a define for
HAVE_LONG_DOUBLE. There's also AC_TYPE_LONG_DOUBLE_WIDER to generate
HAVE_LONG_DOUBLE_WIDER so that we could know not to bother with
separate routines from double. I hadn't gotten far enough along to ask
the mailing list. But since you've brought up the general topic, this
seems like a good time to ask.)
A similar question arises as to whether we can assume that float.h
is present.
I see that ldtoa.c assumes the presence of both long double and
float.h, so perhaps that has set the precedent that no checks are
needed.
Another general question: since long double is inherently an
ANSI/ISO C type (having been introduced in C99), can the non-ANSI
compiler
nonsense be dispensed with when implementing any functions which use
long double? (That is, can the _EXFUN/_DEFUN stuff be skipped going
forward with long double stuff?) It would be so much easier to look at
and less work to create and maintain. I have taken this approach in the
long double math library routines that I've done so far, although I had
been assuming that they'd need to be gated with
#if defined(HAVE_LONG_DOUBLE) just to guard against compilers that might
not have long double (small microcontrollers, for example) even though
they are otherwise ANSI/ISO.
(By the way, so far for the math library I have ceill, floorl,
nearbyintl, rintl, truncl, fpclassify, and some of the other similar
easy ones. They basically function but need polish. I will need some
kind of help for the numerical (e.g. sine, log) functions as I don't
know enough to write them. Anyone who'd like to help, let me know.)
Perhaps this email is creating a branch off your starting topic and
should have the subject changed to separate them, but I wasn't sure how
much traffic it would make on its own, so I didn't do so, yet.
Craig
-----Original Message-----
From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
On Behalf Of Corinna Vinschen
Sent: Tuesday, March 10, 2009 1:54 PM
To: newlib@sourceware.org
Subject: strtold?
Hi,
I'm just implementing wscanf and friends. While I'm at it, I'm
stumbling over the missing wcstold functionality. Strange enough,
newlib has a strtold function in libc/stdlib/ldtoa.c. However, that
function is actually called _strtold and not mentioned in the header
files at all. But it's used in vfscanf.c.
Here's the question: Why is strtold not "officially" exported when
the function is actually available? Is there any good reason?
If not, I'd suggest to declare strtold in stdlib.h. Then I could
implement wcstold along the lines of the current wcstod function and
we would get long double support in wscanf more or less for free.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
More information about the Newlib
mailing list