xref: /openbmc/qemu/tests/tcg/s390x/long-double.c (revision 8c6631e6)
1 /*
2  * Perform some basic arithmetic with long double, as a sanity check.
3  * With small integral numbers, we can cross-check with integers.
4  */
5 
6 #include <assert.h>
7 
8 int main()
9 {
10     int i, j;
11 
12     for (i = 1; i < 5; i++) {
13         for (j = 1; j < 5; j++) {
14             long double la = (long double)i + j;
15             long double lm = (long double)i * j;
16             long double ls = (long double)i - j;
17 
18             assert(la == i + j);
19             assert(lm == i * j);
20             assert(ls == i - j);
21         }
22     }
23     return 0;
24 }
25