diff options
author | van Hauser <vh@thc.org> | 2021-12-13 22:58:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-13 22:58:19 +0100 |
commit | 22e2362f0fd5685548696f487639104a0059e3eb (patch) | |
tree | f59a3c6d5fb0f42056252f400f3bab1e1010432b /test/test-fp_minusZerocases.c | |
parent | 08ca4d54a55fe73e64a994c41a12af61f52e497e (diff) | |
parent | c6bad07d75aa36671ebc32a722566cb145414b08 (diff) | |
download | afl++-22e2362f0fd5685548696f487639104a0059e3eb.tar.gz |
Merge pull request #1213 from AFLplusplus/dev
push to stable
Diffstat (limited to 'test/test-fp_minusZerocases.c')
-rw-r--r-- | test/test-fp_minusZerocases.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test-fp_minusZerocases.c b/test/test-fp_minusZerocases.c new file mode 100644 index 00000000..f821f2ab --- /dev/null +++ b/test/test-fp_minusZerocases.c @@ -0,0 +1,35 @@ +/* test cases for floating point comparison transformations + * compile with -DFLOAT_TYPE=float + * or -DFLOAT_TYPE=double + * or -DFLOAT_TYPE="long double" + */ + +#include <assert.h> +#define _GNU_SOURCE +#include <math.h> /* for NaNs and infinity values */ + +int main() { + + volatile FLOAT_TYPE a, b; + + /* negative zero */ + a = 1.0 / -(1.0 / 0.0); /* negative 0 */ + b = 0.0; /* positive 0 */ + assert(!(a < b)); + assert((a <= b)); + assert(!(a > b)); + assert((a >= b)); + assert(!(a != b)); + assert((a == b)); + + a = 1.0 / -(1.0 / 0.0); /* negative 0 */ + b = 1.0 / -(1.0 / 0.0); /* negative 0 */ + assert(!(a < b)); + assert((a <= b)); + assert(!(a > b)); + assert((a >= b)); + assert(!(a != b)); + assert((a == b)); + +} + |