From: bill@sfu.ca (Bill Baines)
Subject: clib atof() question
Date: Thu, 14 Oct 1993 04:36:48 GMT [thread overview]
Message-ID: <1993Oct14.043648.1611@sfu.ca> (raw)
I was porting a program called SatTrack from Sun to neXT and VAX/VMS in
preparation for tracking the shuttle STS-58 due to launch on Thursday.
The program was written by Manfred Bester, (DL5KR) is excellent, and works
well on the Sun platforms I have run it on.
On the NeXT, I ran into som problems. The satellite orbital data is
read from ascii files which are parsed up calculated upon by SatTrack. One
function makes extensive use of atof(). Return values from that function
are wild -- beyond anything that could be called round-off error.
I am not a great c programmer, so I wrote a little test program to validate my
understanding ot atof(). The outputs on various systems is below the source.
--------------------
#include <math.h>
int main()
{
double f1;
char *s1 = "1234.567";
f1 = atof(s1);
printf("%s, %f\n",s1, f1);
}
--------------------
1) On SunOS 4.?
1234.567, 1234.567000 [OK!]
2) On NeXTOS 3.0
1234.567, 1083394628.000000 [Not ok]
3) Silicon Graphics IRIX 4.?
1234.567, 1234.567000 [OK!]
4) VAX/VMS
(D_FLOAT)
1234.567, 1378108826.000000 [Not ok]
(G_FLOAT)
1234.567, 1245986995.000000 [Not ok]
So, Sun and SGI seem to work while Next and VMS don't. Have I left something
out here? Compiler switches?
Ideas appreciated.
--
Bill Baines, Operations and Tech. Support,
Simon Fraser University, Vancouver, British Columbia, Canada
bill@sfu.ca, (604) 291-3955, (fax 291-4242), VE7FML
next reply other threads:[~1993-10-14 4:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-10-14 4:36 Bill Baines [this message]
1993-10-14 13:06 ` clib atof() question Bob Doherty
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