Compile w/ "gcc -lm shit.c"
#include <math.h>
#include <stdio.h>
#include <fpu_control.h>
main()
{
printf("Before FPU stuff: %d\n", (int)(log(8.0)/log(2.0)));
/* This puts the X86 FPU in 64-bit precision mode. The default
* under Linux is to use 80-bit mode, which produces subtle
* differences from FreeBSD and other systems, eg,
* (int)(1000*atof("0.3")) is 300 in 64-bit mode, 299 in 80-bit
* mode.
*/
fpu_control_t cw;
_FPU_GETCW(cw);
cw &= ~_FPU_EXTENDED;
cw |= _FPU_DOUBLE;
_FPU_SETCW(cw);
printf("After FPU stuff: %d\n", (int)(log(8.0)/log(2.0)));
}