Mail Archives: djgpp-workers/2003/01/11/05:18:06
Hello.
Eli Zaretskii wrote:
>
> > Date: Wed, 8 Jan 2003 15:16:10 -0500
> > From: "cvs-richdawe AT delorie DOT com" <cvs AT delorie DOT com>
> >
> > + If a number represented by @var{s} doesn't fit into the range of values
> > + representable by the type @code{double}, the function returns either
> > + @code{-HUGE_VAL} (if @var{s} begins with the character @code{-}) or
> > + @code{+HUGE_VAL}, and sets @code{errno} to @code{ERANGE}.
>
> We are talking about strtof here, right? strtof returns a float,
> right? So the second line should say "@code{float}" instaed of
> "@code{double}", and we shouldn't return HUGE_VAL (which is a double
> value and is not necessarily representable by a float), but rather
> some other value. What does glibc's strtof do in that case?
Oops. Thanks for catching that. According to C99: strtof should return
HUGE_VALF; strtod should return HUGE_VAL; strtold should return HUGE_VALL. The
glibc 2.2.93 sources (from RedHat 8.0) return HUGE_VALF from strtof.
HUGE_VALF and HUGE_VALL are just float and long double versions of HUGE_VAL.
Here's what I propose: I will fix the double -> float mistake now. The
HUGE_VAL -> HUGE_VALF problem I will fix in a later patch. (HUGE_VAL* on the
C99 compliance to-do list.) Is this satisfactory?
Bye, Rich =]
--
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
- Raw text -