aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/s390x/long-double.c
blob: 757a6262fd942786953dba62450cb214752a4550 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * Perform some basic arithmetic with long double, as a sanity check.
 * With small integral numbers, we can cross-check with integers.
 */

#include <assert.h>

int main()
{
    int i, j;

    for (i = 1; i < 5; i++) {
        for (j = 1; j < 5; j++) {
            long double la = (long double)i + j;
            long double lm = (long double)i * j;
            long double ls = (long double)i - j;

            assert(la == i + j);
            assert(lm == i * j);
            assert(ls == i - j);
        }
    }
    return 0;
}