summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Fu <vincent.fu@wdc.com>2019-10-16 12:32:42 -0400
committerVincent Fu <vincent.fu@wdc.com>2019-11-06 11:18:59 -0500
commit1c75cb5febdfdea9f9b6999e222859fcf2c2e801 (patch)
tree4ff923bd943c9df164e554ee43a895f37a8bb349
parentd5c4f97458d59689c3d1a13831519617d000fb19 (diff)
downloadfio-1c75cb5febdfdea9f9b6999e222859fcf2c2e801.tar.gz
fio-1c75cb5febdfdea9f9b6999e222859fcf2c2e801.tar.bz2
t/iee754: add return value
To facilitate automated testing, return 0 when all tests succeed and a non-zero value otherwise. Also add one more test value.
-rw-r--r--t/ieee754.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/t/ieee754.c b/t/ieee754.c
index 3898ab74..b6526394 100644
--- a/t/ieee754.c
+++ b/t/ieee754.c
@@ -1,21 +1,26 @@
#include <stdio.h>
#include "../lib/ieee754.h"
-static double values[] = { -17.23, 17.23, 123.4567, 98765.4321, 0.0 };
+static double values[] = { -17.23, 17.23, 123.4567, 98765.4321,
+ 3.14159265358979323, 0.0 };
int main(int argc, char *argv[])
{
uint64_t i;
- double f;
- int j;
+ double f, delta;
+ int j, differences = 0;
j = 0;
do {
i = fio_double_to_uint64(values[j]);
f = fio_uint64_to_double(i);
- printf("%f -> %f\n", values[j], f);
+ delta = values[j] - f;
+ printf("%26.20lf -> %26.20lf, delta = %26.20lf\n", values[j],
+ f, delta);
+ if (f != values[j])
+ differences++;
j++;
} while (values[j] != 0.0);
- return 0;
+ return differences;
}