Merge branch 'master' of https://github.com/bvanassche/fio
[fio.git] / t / ieee754.c
CommitLineData
61f78f3a 1#include <stdio.h>
f98f3d07 2#include "../lib/ieee754.h"
61f78f3a 3
1c75cb5f
VF
4static double values[] = { -17.23, 17.23, 123.4567, 98765.4321,
5 3.14159265358979323, 0.0 };
61f78f3a
JA
6
7int main(int argc, char *argv[])
8{
9 uint64_t i;
1c75cb5f
VF
10 double f, delta;
11 int j, differences = 0;
61f78f3a
JA
12
13 j = 0;
14 do {
15 i = fio_double_to_uint64(values[j]);
16 f = fio_uint64_to_double(i);
1c75cb5f
VF
17 delta = values[j] - f;
18 printf("%26.20lf -> %26.20lf, delta = %26.20lf\n", values[j],
19 f, delta);
20 if (f != values[j])
21 differences++;
61f78f3a
JA
22 j++;
23 } while (values[j] != 0.0);
24
1c75cb5f 25 return differences;
61f78f3a 26}