Here's a small test-case:
#include <stdio.h>
#include <math.h>
#include <fenv.h>
int cvt(float f) { return (int)rint(f); }
int main() {
printf("%d %d %d %d\n", cvt(23.7), cvt(23.23), cvt(-23.7),
cvt(-23.23));
fesetround(FE_TONEAREST);
printf("%d %d %d %d\n", cvt(23.7), cvt(23.23), cvt(-23.7),
cvt(-23.23));
fesetround(FE_TOWARDZERO);
printf("%d %d %d %d\n", cvt(23.7), cvt(23.23), cvt(-23.7),
cvt(-23.23));
fesetround(FE_UPWARD);
printf("%d %d %d %d\n", cvt(23.7), cvt(23.23), cvt(-23.7),
cvt(-23.23));
fesetround(FE_DOWNWARD);
printf("%d %d %d %d\n", cvt(23.7), cvt(23.23), cvt(-23.7),
cvt(-23.23));
return 0;
}
Correct output is:
24 23 -24 -23
24 23 -24 -23
23 23 -23 -23
24 24 -23 -23
23 23 -24 -24
This output happens on the libc compiled with gcc 3.3.
However, on hppa with gcc 4.0, you see:
24 23 -24 -23
24 23 -24 -23
24 23 -24 -23
24 23 -24 -23
24 23 -24 -23
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]