Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Nov 2001 13:51:06 +0100 (CET)
From:      "Ralf S. Engelschall" <rse@en1.engelschall.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/31820: strdod(3): HUGE_VAL expected in <stdlib.h>, but is in <math.h>
Message-ID:  <200111071251.fA7Cp6839790@en1.engelschall.com>

next in thread | raw e-mail | index | archive | help


>Number:         31820
>Category:       misc
>Synopsis:       strdod(3): HUGE_VAL expected in <stdlib.h>, but is in <math.h>
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 07 05:00:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Ralf S. Engelschall
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
Engelschall, Germany.
>Environment:
System: FreeBSD en1.engelschall.com 4.4-STABLE FreeBSD 4.4-STABLE #0: Sun Oct 28 17:45:23 CET 2001 root@en1.engelschall.com:/v/dsk/0/g/src/sys/compile/EN1 i386

>Description:

The manpage of strtod(3) correctly (according to SUSv2) says:

   [...]
   SYNOPSIS
     #include <stdlib.h>
     double strtod(const char *nptr, char **endptr);
   [...]
   RETURN VALUES
   [...]
     If the correct value would cause overflow, plus or minus HUGE_VAL is
     returned [...]

Unfortunately just including <stdlib.h> is not sufficient to get the
definition of HUGE_VAL, because it is defined in our <math.h>. We follow
closely SUSv2 here, so saying that the user should also include <math.h>
is more than what the standard dictates. OTOH always including <math.h>
from <stdlib.h> is also not reasonable, of course.

>How-To-Repeat:

#include <stdlib.h>
#ifndef HUGE_VAL
#error "strtod(3) says it should be defined now"
#endif

>Fix:

I don't know what the best fix for this is. Fact is that SUSv2 says
<stdlib.h> is enough. I don't know whether we nevertheless say "include
also <stdlib.h>" in our FreeBSD version of strtod(3) or whether we hack
our includes so math.h's HUGE_VAL is available through stdlib.h, too.
Someone else has to decide on a correct solution. It certainly is not
a major problem, but a little bit nasty because at least our strtod(3)
does not reflect the FreeBSD reality.

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111071251.fA7Cp6839790>