All pastes #58180 Raw Edit

Something

public text v1 · immutable
#58180 ·published 2006-05-22 22:16 UTC
rendered paste body
donavan@zimbu:~ >cat abc.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)));
}
donavan@zimbu:~ >gcc -lm abc.c
donavan@zimbu:~ >./a.out
Before FPU stuff: 3
After FPU stuff: 3
donavan@zimbu:~ >