delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/11/05:18:06

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3E1FEF1F.C891D5CF@phekda.freeserve.co.uk>
Date: Sat, 11 Jan 2003 10:17:03 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: djgpp: djgpp/src/libc/c99/stdlib/makefile,strtof.c,strtof.txh
References: <200301082016 DOT h08KGA210951 AT delorie DOT com> <2593-Fri10Jan2003220759+0200-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019