about summary refs log tree commit diff
path: root/test/test-floatingpoint.c
blob: f78b5d9f08cb3a62e6da74093f596092f12c9dcf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdlib.h>
#include <unistd.h>

int main(void)
{
    long double magic;

    ssize_t bytes_read = read(STDIN_FILENO, &magic, sizeof(magic));
    if (bytes_read < (ssize_t)sizeof(magic)) {
        return 1;
    }

    if( (-magic == 15.0 + 0.5 + 0.125 + 0.03125 + 0.0078125) ){ /* 15 + 1/2 + 1/8 + 1/32 + 1/128 */
        abort();
    }

    return 0;
}