Fix floating point number comparisons in testsuite/libffi.call/float[123].c.

Rewrite the checks for approximate equality of floating point return
values to be in the form "fabs(a - b) < EPS" instead of just
"a - b < EPS".
This commit is contained in:
Anatoly Trosinenko
2014-11-14 13:18:04 +03:00
parent 4aa702a0e0
commit 9622ede2e2
3 changed files with 10 additions and 4 deletions

View File

@@ -8,6 +8,8 @@
#include "ffitest.h"
#include "float.h"
#include <math.h>
static long double ldblit(float f)
{
return (long double) (((long double) f)/ (long double) 3.0);
@@ -47,7 +49,7 @@ int main (void)
#endif
/* These are not always the same!! Check for a reasonable delta */
if (ld - ldblit(f) < LDBL_EPSILON)
if (fabsl(ld - ldblit(f)) < LDBL_EPSILON)
puts("long double return value tests ok!");
else
CHECK(0);