From: Jens Axboe Date: Wed, 5 Oct 2011 08:25:54 +0000 (+0200) Subject: Add IEEE 754 test case X-Git-Tag: fio-1.99~2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=61f78f3ada575804c6d4ba0936cf64c17728eaba;ds=sidebyside Add IEEE 754 test case Signed-off-by: Jens Axboe --- diff --git a/Makefile b/Makefile index da0bb199..2b9c006b 100644 --- a/Makefile +++ b/Makefile @@ -63,9 +63,16 @@ endif OBJS = $(SOURCE:.c=.o) -T_OBJS = t/stest.o -T_OBJS += mutex.o smalloc.o t/log.o -T_PROGS = t/stest +T_SMALLOC_OBJS = t/stest.o +T_SMALLOC_OBJS += mutex.o smalloc.o t/log.o +T_SMALLOC_PROGS = t/stest + +T_IEEE_OBJS = t/ieee754.o +T_IEEE_OBJS += ieee754.o +T_IEEE_PROGS = t/ieee754 + +T_OBJS = $(T_SMALLOC_OBJS) +T_OBJS += $(T_IEEE_OBJS) ifneq ($(findstring $(MAKEFLAGS),s),s) ifndef V @@ -84,8 +91,11 @@ all: .depend $(PROGS) $(SCRIPTS) .c.o: .depend $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $< -t/stest: $(T_OBJS) - $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_OBJS) $(LIBS) $(LDFLAGS) +t/stest: $(T_SMALLOC_OBJS) + $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS) + +t/ieee754: $(T_IEEE_OBJS) + $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_IEEE_OBJS) $(LIBS) $(LDFLAGS) fio: $(OBJS) $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS) diff --git a/t/ieee754.c b/t/ieee754.c new file mode 100644 index 00000000..afc25f3c --- /dev/null +++ b/t/ieee754.c @@ -0,0 +1,21 @@ +#include +#include "../ieee754.h" + +static double values[] = { -17.23, 17.23, 123.4567, 98765.4321, 0.0 }; + +int main(int argc, char *argv[]) +{ + uint64_t i; + double f; + int j; + + j = 0; + do { + i = fio_double_to_uint64(values[j]); + f = fio_uint64_to_double(i); + printf("%f -> %f\n", values[j], f); + j++; + } while (values[j] != 0.0); + + return 0; +}