diff options
Diffstat (limited to 'test/test-floatingpoint.c')
-rw-r--r-- | test/test-floatingpoint.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test-floatingpoint.c b/test/test-floatingpoint.c new file mode 100644 index 00000000..8f691c2c --- /dev/null +++ b/test/test-floatingpoint.c @@ -0,0 +1,20 @@ +#include <stdlib.h> +#include <unistd.h> + +int main(void) { + + float 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; + +} + |