mirabilos added the comment: mirabilos dixit:
>mirabilos added the comment: >Yes, that’s precisely what’s not working on the most widespread >emulator, at the very least. (I have working code for that, in >three(!) variants, but it just ignores those requests to change >precision.) Here’s the Python testcase made into a standalone test: -----BEGIN cutting here may damage your screen surface----- #include <stdio.h> #include <stdlib.h> #include <math.h> #ifndef __MirBSD__ #include <fpu_control.h> #endif void runtests(void); void runtests(void) { volatile double x, y, z; /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */ x = 0.99999999999999989; /* 1-2**-53 */ y = 1./x; printf("test#1 %s: %.17E\n", (y == 1.) ? "fail" : "good", y); /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */ x = 1e16; y = 2.99999; z = x + y; printf("test#2 %s: %.17E\n", z == 1e16+4. ? "fail" : "good", z); } int main(void) { #ifdef _FPU_SETCW fpu_control_t cwold, cwnew, cwgot; #endif runtests(); #if (defined(__i386__) || defined(__m68k__)) && defined(_FPU_SETCW) _FPU_GETCW(cwold); #ifdef __i386__ cwnew = 0x127f; #else cwnew = _FPU_RC_NEAREST | _FPU_DOUBLE; #endif _FPU_SETCW(cwnew); _FPU_GETCW(cwgot); printf("changing FPU control word from %08X to %08X => %08X\n", cwold, cwnew, cwgot); runtests(); #endif return (0); } -----END cutting here may damage your screen surface----- Here’s the result of running it on the latest ARAnyM, which did get MPFR-based FPU emulation bugfixes, but apparently still ignores any FPUCW changes (or, at least the ones relating to precision): root@ara3:~ # ./a.out test#1 fail: 1.00000000000000000E+00 test#2 fail: 1.00000000000000040E+16 changing FPU control word from 00000000 to 00000080 => 00000080 test#1 fail: 1.00000000000000000E+00 test#2 fail: 1.00000000000000040E+16 bye, //mirabilos -- "Using Lynx is like wearing a really good pair of shades: cuts out the glare and harmful UV (ultra-vanity), and you feel so-o-o COOL." -- Henry Nelson, March 1999 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18062> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com