From: doherty@bhnrc.usda.gov (Bob Doherty)
Subject: Re: clib atof() question
Date: 14 Oct 93 09:06:51 EDT [thread overview]
Message-ID: <1993Oct14.090651.80@bhnrc.usda.gov> (raw)
In-Reply-To: 1993Oct14.043648.1611@sfu.ca
In article <1993Oct14.043648.1611@sfu.ca>, bill@sfu.ca (Bill Baines) writes:
[snip, snip]
> --------------------
> #include <math.h>
> int main()
> {
> double f1;
> char *s1 = "1234.567";
>
> f1 = atof(s1);
> printf("%s, %f\n",s1, f1);
> }
> --------------------
[snip, snip]
> So, Sun and SGI seem to work while Next and VMS don't. Have I left something
> out here? Compiler switches?
>
The problem is that the atof prototype is specified by the ANSI standard
to be in stdlib.h, not math.h. Even though VAX/VMS C is not an ANSI C
compiler, the atof prototype is in stdlib.h. The same situation obtains
for Next, apparently. It appears as if SunOS and IRIX get it wrong.
With the change in the included file to stdlib.h, under VAX/VMS C and
gcc under VMS, the above program produces the same output as SunOS and
IRIX.
--
*********************************************************************
* Bob Doherty * Beltsville Human Nutrition Research Center *
* B161 R216A * EMAIL: doherty@bhnrc.usda.gov *
* BARC-East * doherty@Eisner.DECUS.Org *
* Beltsville, MD 20705 * bob.doherty@his.com *
* (301)-504-8147 * *
*********************************************************************
next prev parent reply other threads:[~1993-10-14 13:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-10-14 4:36 clib atof() question Bill Baines
1993-10-14 13:06 ` Bob Doherty [this message]
1993-10-14 13:18 ` Ken Cowan
1993-10-15 0:32 ` clib atof() question resolved... Thanks!!! Bill Baines
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox