The disagreement of glibc and mingw-w64 (in my opinion) is definitely glibc's 
bug:

    lh_mouse@lhmouse-dev:~$ cat test3.c 
    #include <stdio.h>
    #include <math.h>
    
    int main(){
            double x = 10.001000;
            double y = 0.701000;
            int quo;
            double rem = remquo(x, y, &quo);
            printf("%f %f %d %f\n", x, y, quo, rem);
    }
    lh_mouse@lhmouse-dev:~$ gcc test3.c -lm -O0 && ./a.out # use glibc
    10.001000 0.701000 8 4.393000
    lh_mouse@lhmouse-dev:~$ gcc test3.c -lm -O2 && ./a.out  # performs constant 
folding
    10.001000 0.701000 14 0.187000
    lh_mouse@lhmouse-dev:~$ 

The remainder of `remquo` from mingw-w64 seems all right.
However the value (or rather, the 3 least significant bits) returned in the 
third parameter
still seems problematic.

------------------                               
Best regards,
lh_mouse
2016-09-06

-------------------------------------------------------------
发件人:"lhmouse"<lh_mo...@126.com>
发送日期:2016-09-05 23:08
收件人:mingw-w64-public,lhmouse
抄送:
主题:Re:  [Mingw-w64-public] Wrong quotient results of `remquo()`?

Found an example on cppreference:
http://en.cppreference.com/w/cpp/numeric/math/remquo

The example shows that, since `cos()` is periodic,
adding 1000000000000 * PI to its parameter doesn't change the result.

But, we can also say that, subtracting 1000000000000 * PI
from its parameter should not change the result either. However,
with mingw-w64 and MSVCRT, it DOES change the result,
as shown on the last line:

    E:\Desktop>g++ test.cpp -std=c++14
    
    E:\Desktop>a.exe
    cos(pi * -0.25) = 0.707107
    cos(pi * -1.25) = -0.707107
    cos(pi * -1000000000000.25) = 0.707123
    cos(pi * -1000000000001.25) = -0.707117
    cos(pi * -1000000000000.25) = 0.707107
    cos(pi * -1000000000001.25) = 0.707107

This could be a potential bug.

------------------                               
Best regards,
lh_mouse
2016-09-05

-------------------------------------------------------------
发件人:"lhmouse"<lh_mo...@126.com>
发送日期:2016-09-05 22:27
收件人:mingw-w64-public
抄送:
主题:[Mingw-w64-public] Wrong quotient results of `remquo()`?

Hello guys,
I am testing my `remquo()` implementation when I find that `remquo`
on Linux (using glibc) and on Windows (using mingw-w64) generate
different results. I don't think this is the correct behavior. Any ideas?

The testcases in file `remquo.txt` the attached zip file was generated
on my VPS running Debian. MinGW-w64 is failing some of them:

    E:\Desktop\remquo_test>gcc test.c -std=c99 && a.exe > nul
    passed: 37864
    failed: 2537
                                
--------------
Best regards,
lh_mouse
2016-09-05
------------------------------------------------------------------------------

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public





------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to