[comp.lang.c] SUMMARY: Problems with atof

huff@kuhub.cc.ukans.edu (Steve Huff, University of Kansas, Lawrence) (05/10/91)

Here's a summary of the responses I received to my question.

Thanks!

----------

From: black@beno.CSS.GOV (Mike Black)

Sounds like you're not doing any real math in your code.  The "no floating
point formats linked" means when you compiled your code the linker didn't
include any float math functions as you didn't do any math in your program.
A lot of people simply recommend putting in a dummy function like:
foo()
{
	float a=1.0;
	a+=1;
}

This will force the linker to include the math functions.  Just calling
a math function like atof() doesn't count.  You HAVE to actually perform
a math operation like the above somewhere in your code.

----------

From: "Robert F. Starr" <airgun!starr@uunet.UU.NET>

If you had this:
	char *pb = "4055";
then you should have done this:
	rec_in.wholesale = atof (pb);

----------

From: mjs@hubcap.clemson.edu (M. J. Saltzman)

Most error messages are in TFM, but this one isn't.  It *would* be
nice if it was--it is so common...  Borland's atof() appears to use
some code in common with sscanf() (not too surprising...).  The
Borland compiler and linker (and most PC compilers) try to finess the
problem of large code size by guessing if the floating point libraries
(where the conversion routines live) are really needed.  All too
frequently, the compiler guesses wrong.  A command line option exists
to override the case where the comiler incorrectly *includes* FP
libraries, but not the case where it incorrectly *excludes* them.  To
force them to be included, call a floating point function, like
sqrt(), exp(), sin(), etc.

----------

From: jrbd@craycos.com (James Davies)

Stick in a call like
	exp(1.0);
somewhere in your program and the problem will magically go away.
Read this newgroup (or the FAQ list) and you'll find out the reason
(someone asks this question once a week on average, I'd guess -- I
wish Borland would explain this better in their manuals and/or the

-- 
Thanks.

Steve
-----
Steve Huff, student, University of Kansas     "Still love that KU basketball!"
Microcomputer Consultant, Hill's Pet Products, Topeka, Kansas
Internet: HUFF@kuhub.cc.ukans.edu  Bitnet: HUFF@UKANVAX  GEIS: HUFF@HILLCORP#