Sometimes it’s all too much…

code 23 June 2009 | 0 Comments

Argh #include <stdio.h> #include <math.h> #include <fenv.h>   int main () { // don’t set rounding here double ten0 = sin(pow(10.0,22));   fesetround(FE_DOWNWARD); double ten1 = sin(pow(10.0,22));   fesetround(FE_UPWARD); double ten2 = sin(pow(10.0,22));   fesetround(FE_TONEAREST); double ten3 = sin(pow(10.0,22));   fesetround(FE_TOWARDZERO); double ten4 = sin(pow(10.0,22));   printf( "Default: %f\n" "Downward: %f\n" "Upward: %f\n" "ToNearest: %f\n" [...]

Tagged in , , , , ,