Re: Build-in sqrt()?



peng.xiaoyu@xxxxxxxxx wrote:

why this c code can be compiled and linked without -lm?

#include<math.h>
#include<stdio.h>
int main()
{
printf("%f\n",sqrt(2.0));
return 0;
}

even NO sqrt symbol when i use nm to list symbols from the object file

someone can give me a hint? i'm using a gcc-4.1.2 with glibc2.4.1 under
linux

First read your handy docs, e.g.
% info gcc
then ask specific further questions on
gcc-help@xxxxxxxxxxx
If you are interested, check your generated code to see whether sqrt() was evaluated at compile time, or at run time using a built-in CPU instruction.
.