Created attachment 587376 [details] Simple test code for pow() Description of problem: Some functions from libm library (in glibc) return unpredictable result in non default rounding mode. Functions are: exp, pow etc. Version-Release number of selected component (if applicable): In RHEL 5.x 6.x, Fedora 16 How reproducible: Always Steps to Reproduce: 1.Compile simple code #include <stdio.h> #include <stdlib.h> #include <math.h> #include <fenv.h> static int modes[4] = { FE_TONEAREST, FE_TOWARDZERO, FE_DOWNWARD, FE_UPWARD }; int main (int argc, char *argv[]) { int i; char *end; double x = strtod (argv[1], &end); if (*end != '\0') exit (EXIT_FAILURE); for (i = 0; i < 4; i++) { double y; fesetround (modes[i]); y = pow (x,-0.34); printf ("pow(%.17g,-0.34) = %.17g\n", x, y); } return 0; } with gcc: "gcc -lm -o round_mode_test round_mode_test.c" 2. Run test code with some input number $ ./round_mode_test 2 pow(2,-0.34) = 0.79004131186337712 pow(2,-0.34) = 0.50032986487121911 pow(2,-0.34) = 0.50032986487121911 pow(2,-0.34) = 0.79004131186337723 $ ./round_mode_test 0.9 pow(0.90000000000000002,-0.34) = 1.0364719344786322 pow(0.90000000000000002,-0.34) = 1.036471934478632 pow(0.90000000000000002,-0.34) = 1.036471934478632 pow(0.90000000000000002,-0.34) = 0.0061468530371330907 Actual results: Different result in different rounding mode Expected results: Same results Additional info: This is glibc bug http://sources.redhat.com/bugzilla/show_bug.cgi?format=multiple&id=3976 with bugfix available.
There are some values which cause segfault in pow() function too.
This was fixed when I pulled in the current glibc develoment sources into Rawhide. I do not currently have plans to backport these changes into F17. However, obviously, they will be in F18.