From: Szabolcs Nagy Date: Wed, 3 Jul 2013 19:04:08 +0000 (+0000) Subject: math: fix cr check, stricter except check X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=db4b6cef06a63b1a43c654c3b98fe4e47fc7d411;hp=de7f58af5be899f70644569d37b05740554d5489;p=libc-test math: fix cr check, stricter except check --- diff --git a/src/math/Makefile b/src/math/Makefile index 5d6b9df..360dc18 100644 --- a/src/math/Makefile +++ b/src/math/Makefile @@ -1,5 +1,6 @@ CFLAGS+=-g -pipe -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wno-unused-function -Wno-missing-braces -CFLAGS+=-Wno-unknown-pragmas -fno-builtin -frounding-math -D_GNU_SOURCE +CFLAGS+=-Wno-unknown-pragmas -fno-builtin -frounding-math +CFLAGS+=-D_GNU_SOURCE -O0 LDFLAGS+=-g -lm SRC=$(sort $(wildcard *.c)) @@ -7,7 +8,7 @@ OBJ=$(SRC:.c=.o) BINOBJ=$(filter-out util.o,$(OBJ)) BIN=$(BINOBJ:.o=) -#include ../../config.mak +-include ../../config.mak all: $(BIN) run: all @@ -20,6 +21,7 @@ $(OBJ): util.h %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< %: %.c + %: %.o $(CC) $(LDFLAGS) -o $@ $^ diff --git a/src/math/util.h b/src/math/util.h index d84b0e3..9218a75 100644 --- a/src/math/util.h +++ b/src/math/util.h @@ -101,11 +101,9 @@ float ulperrl(long double got, long double want, float dwant); static int checkexcept(int got, int want, int r) { - // TODO: we dont checkunderflow and inexact for now if (r == RN) - return (got|INEXACT|UNDERFLOW) == (want|INEXACT|UNDERFLOW); -// return got == want || got == (want|INEXACT); - return 1; + return got == want || got == (want|INEXACT); + return (got|INEXACT|UNDERFLOW) == (want|INEXACT|UNDERFLOW); } static int checkulp(float d, int r) @@ -120,6 +118,6 @@ static int checkcr(long double y, long double ywant, int r) { if (isnan(ywant)) return isnan(y); - return y == ywant; + return y == ywant && signbit(y) == signbit(ywant); }