More likely a bug in mingw-w64:

    #include <stdio.h>
    #include <math.h>
    volatile double x = 10.001000, y = -1.299000;
    int main(){
        int quo;
        double rem = remquo(x, y, &quo);
        printf("rem = %f, quo = %d\n", rem, quo);
    }

With mingw-w64 this program gives the following output:

    E:\Desktop>gcc test.c
    
    E:\Desktop>a
    rem = -0.391000, quo = 0

However, according to ISO C11 draft:

> 7.12.10.3 The remquo functions
> 2 The remquo functions compute the same remainder as the remainder functions. 
> In
> the object pointed to by quo they store a value whose sign is the sign of x/y 
> and whose
> magnitude is congruent modulo 2n to the magnitude of the integral quotient of 
> x/y, where
> n is an implementation-defined integer greater than or equal to 3.

the value stored in `quo` must have the same sign with `x/y`.

In the above example, since `x/y`, which is about -7.699, is negative,
returning a non-negative value (zero in the above example) should be a bug.

------------------                               
Best regards,
lh_mouse
2016-09-07




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

Reply via email to