From: nsz Date: Sat, 10 Mar 2012 10:35:49 +0000 (+0100) Subject: simple tgmath test X-Git-Url: http://nsz.repo.hu/git/?p=libm;a=commitdiff_plain;h=bc7a053425f94041d6672d2a4432dd4f89a1e1b8 simple tgmath test --- diff --git a/test/tgmath/Makefile b/test/tgmath/Makefile new file mode 100644 index 0000000..b11fcf6 --- /dev/null +++ b/test/tgmath/Makefile @@ -0,0 +1,16 @@ +CFLAGS=-g -Wall -D_GNU_SOURCE -fno-builtin -ffloat-store -std=c99 -I../../include +LDFLAGS=-g + +all: tsystem + +clean: + rm -f *.o t tsystem + +t.o: t.c + $(CC) $(CFLAGS) -c -o $@ $< + +t: t.o ../../lib/libm.a + $(CC) $(LDFLAGS) -o $@ $+ + +tsystem: t.o + $(CC) $(LDFLAGS) -lm -o $@ $< diff --git a/test/tgmath/t.c b/test/tgmath/t.c new file mode 100644 index 0000000..836add5 --- /dev/null +++ b/test/tgmath/t.c @@ -0,0 +1,26 @@ +#include "tgmath.h" +#include +#include + + +int main() +{ + long double i = sin(1); + long double d = sin(1.0); + long double f = sin(1.0f); + long double l = sin(1.0l); + + long double complex dc = sin(1.0+0*I); + long double complex fc = sin(1.0f+0*I); + long double complex lc = sin(1.0l+0*I); + + printf("i %2u %La\n", sizeof sin(1), i); + printf("d %2u %La\n", sizeof sin(1.0), d); + printf("f %2u %La\n", sizeof sin(1.0f), f); + printf("l %2u %La\n", sizeof sin(1.0l), l); + + printf("dc %2u %La %La\n", sizeof sin(1.0+0*I), creall(dc), cimagl(dc)); + printf("fc %2u %La %La\n", sizeof sin(1.0f+0*I), creall(fc), cimagl(fc)); + printf("lc %2u %La %La\n", sizeof sin(1.0l+0*I), creall(lc), cimagl(lc)); + return 0; +}