[lug] math.h Weirdness
Zan Lynx
zlynx at acm.org
Tue Mar 13 15:57:03 MDT 2007
On Tue, 2007-03-13 at 07:09 -0600, Bill Thoen wrote:
> Thanks Lori,
>
> The sqrt example listed in that article was exactly the situation I
> encountered. Using -lm did the trick. Funny thing though; with some code
> I write I don't need to explicitly link to the math library, but on this
> module, I had to or it wouldn't resolve sqrt().
>
> Also, I found that the protoype for sqrt _is_ in math.h. It's immplemented
> as a macro in bits/mathcalls.h and included.
>
> Thanks for the help!
Often, if you compile with -O2 or -O3, and have a GCC that has been
distro-optimized for i686 or are using a Athlon64 or Xeon or Core2 in
64-bit mode, or if you specify -march/-mcpu yourself, then the math
functions will compile directly to machine code, and no library is
needed. Sometimes you also need -ffast-math.
--
Zan Lynx <zlynx at acm.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20070313/ba02b3e9/attachment.pgp>
More information about the LUG
mailing list