AFAIK the main difference between enabling and disabling -ffast-math is
that if you, for example, call sin() function (or cos(), or tan(), ...)
in your program the compiler generates a corresponding libc function
call. In the opposite case (enabled -ffast-math) the compiler inserts
the assembler instruction (of course, if a given processor supports it)
rather then function call.
As you understand the result appears sooner in the latter case and
(theoretically) any 3d program would work faster if compiled with
-ffast-math.
On the other hand, the processor instructions know nothing about POSIX
and other standards so the program compiled with the option cannot rely
on any standards and especially cannot rely on errno value. That's why
it isn't recommended to compile the toolchain with -ffast-math.
Besides, if the program contains _only_ the functions that can be
translated into assembler instructions you need not to link your
executable with libm.
For example, look at the following:
$ cat >a.c <<EOF
#include <math.h>
#include <errno.h>
int main ()
{
volatile double s = sqrt (-1);
printf ("%d\n", errno);
}
EOF
$ cc a.c -lm
$ ./a.out
33
$ cc -ffast-math a.c
$ ./a.out
0
$ uname -p
AMD Athlon(tm) XP 2500+
--
Nothing but perfection
pv
--
http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page