The root cause for these test suite failures seems to be the different
precision of the C language type 'long double' on ppc architectures.
They are using 106-bit precision compared to the x86 precision of 80-bit.

For example the following program gives different results:

<<<< C program <<<<
#include <stdio.h>

int main() {

    printf("IEC 559 support: ");
#ifdef __STDC_IEC_559__
    printf("yes\n");
#else
    printf("no\n");
#endif

    printf("sizeof(long double) = %zu\n", sizeof(long double));

    long double a = 0.0005L;
    long double b = 0.0004L;

    printf("0.0005 - 0.0004 < 0.0001 = %s\n", a - b < 0.0001L ? "true"
: "false");

    printf("(0.0005 - 0.0004) = %.50Lf hex: ", a);
    for (unsigned j = 0; j < sizeof(long double); j++) {
        printf("%2x ", ((unsigned char *)&a)[j]);
    }
    printf("\n");

    return 0;
}
>>>> C program >>>>

<<<< amd64 output <<<<
IEC 559 support: yes
sizeof(long double) = 16
0.0005 - 0.0004 < 0.0001 = true
(0.0005 - 0.0004) =
0.00049999999999999999997924769279226964169282609873 hex: 3b df 4f 8d
97 6e 12 83 f4 3f 40  0  0  0  0  0
>>>> amd64 output >>>>

<<<< ppc64el output <<<<
IEC 559 support: yes
sizeof(long double) = 16
0.0005 - 0.0004 < 0.0001 = false
(0.0005 - 0.0004) =
0.00050000000000000000000000000000000279259841936149 hex: fc a9 f1 d2
4d 62 40 3f f8 7e 6a bc 74 93 c8 bb
>>>> ppc64el output >>>>

The test suite of check depends on the precision of long double, e.g.
https://sources.debian.org/src/check/0.12.0-0.2/tests/check_check_sub.c/#L783
.

I think there is no problem with check handling the type 'long double'
in general, so the test suite failures should not lead to regressions
in caller code.

Reply via email to