Mercurial > hg > octave-shane > gnulib-hg
diff tests/test-hypotf.c @ 16574:4acf461e0a81
hypot* tests: More tests.
* tests/test-hypot.h: New file, partially extracted from
tests/test-hypotl.c.
* tests/test-hypot.c: Include test-hypot.h.
(main): Invoke test_function.
* tests/test-hypotf.c: Include test-hypot.h.
(main): Invoke test_function.
* tests/test-hypotl.c: Include fpucw.h and test-hypot.h.
(main): Invoke BEGIN_LONG_DOUBLE_ROUNDING and test_function.
* modules/hypot-tests (Files): Add tests/test-hypot.h, tests/randomd.c.
(Makefile.am): Add randomd.c to test_hypot_SOURCES.
* modules/hypotf-tests (Files): Add tests/test-hypot.h,
tests/randomf.c.
(Makefile.am): Add randomf.c to test_hypotf_SOURCES.
* modules/hypotl-tests (Files): Add tests/test-hypot.h,
tests/randoml.c.
(Depends-on): Add 'fpucw', 'float'.
(Makefile.am): Add randoml.c to test_hypotl_SOURCES.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 05 Mar 2012 13:21:47 +0100 |
parents | 026ce065f317 |
children | e542fd46ad6f |
line wrap: on
line diff
--- a/tests/test-hypotf.c +++ b/tests/test-hypotf.c @@ -27,9 +27,18 @@ #include "macros.h" -volatile float x; -volatile float y; -float z; +#undef MIN +#undef MAX + +#define DOUBLE float +#define HUGEVAL HUGE_VALF +#define L_(literal) literal##f +#define MANT_DIG FLT_MANT_DIG +#define MIN FLT_MIN +#define MAX FLT_MAX +#define HYPOT hypotf +#define RANDOM randomf +#include "test-hypot.h" int main () @@ -40,23 +49,7 @@ z = hypot (x, y); ASSERT (z >= 0.7211102f && z <= 0.7211103f); - /* Overflow. */ - x = FLT_MAX; - y = FLT_MAX * 0.5f; - z = hypotf (x, y); - ASSERT (z == HUGE_VALF); - - /* No underflow. */ - x = FLT_MIN; - y = 0.0f; - z = hypotf (x, y); - ASSERT (z == FLT_MIN); - - /* No underflow. */ - x = FLT_MIN * 2.0f; - y = FLT_MIN * 3.0f; - z = hypotf (x, y); - ASSERT (z >= FLT_MIN * 2.0f && z <= FLT_MIN * 4.0f); + test_function (); return 0; }