*BSD News Article 5167


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!spool.mu.edu!uunet!decwrl!claris!szebra!David.Fox
From: David.Fox@Saigon.COM
Newsgroups: comp.unix.bsd
Subject: atof() broken?
Keywords: atof(), conversion, math
Message-ID: <1992Sep17.020317.12165@Saigon.COM>
Date: 17 Sep 92 02:03:17 GMT
Organization: Station Zebra Corp, Sunnyvale CA Ph:408-739-1520
Lines: 14

Hi.  I got the source to J 5.1 (apl like language) sometime back and
attempted to compile it, only to discover that the program required
the use of the strtod() function, and gave an unresolved external to
that effect.

I looked at the man pages, and found that strtod wasn't yet available, so
I substituted atof() for it in the source code.  I was surprised to find that
the software didn't like any numeric input and was giving me only integer
results to floating point operations.

I tried a test program using it:

containing the line z = atof("113.5432"); and when printfed, I only got
113.