On 11/06/2012 21:20, t-rexky wrote:
#include<math.h>
#include<stdio.h>
int main() {
printf("%lf\n", acos(0.5));
return 0;
}
First, note that acos(0.5) is a "double" expression so its format should
be %f. However %lf is tolerated and this should not cause any trouble.
Second, the acos() call will be internally replaced by __builtin_acos()
which may be directly replaced by its result, if it can be computed at
compile time (which is the case in your example).
Try to add -fno-builtin on the command line to see if the same odd
things happen.
nextstep[Tests]$xgcc acos_test.c -o acos_test
<built-in>:0: warning: '__builtin_acos' used but never defined
/NextDeveloper/Headers/ansi/math.h:55: warning: 'acos' used but never defined
The problem may be in your math.h. This header is not provided by GCC,
but by your math library. You should have a look to the indicated line
to see what is there.
Also, looking at the preprocessor output may help.
Try this:
xgcc -E acos_test.c
Then search for acos to see if there is nothing wierd.
Good luck.
--
Vincent Rivière