X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-logb.c;h=d65d2895bbda416add9e29d14c5129a50b83b154;hb=bbfcd2f1a92c9bdbb8d7d7d0a8a8c6665c316747;hp=8b7a612d8cf4095f02b22f9bf5ef502e8233a13e;hpb=de58fd98f4ede3c8da870f8df3934735ee1a3531;p=gnulib.git diff --git a/tests/test-logb.c b/tests/test-logb.c index 8b7a612d8..d65d2895b 100644 --- a/tests/test-logb.c +++ b/tests/test-logb.c @@ -1,5 +1,5 @@ /* Test of logb() function. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,38 +25,30 @@ SIGNATURE_CHECK (logb, double, (double)); #include +#include "minus-zero.h" #include "macros.h" -volatile double x; -double y; +#define DOUBLE double +/* The use of 'volatile' guarantees that excess precision bits are dropped + when dealing with denormalized numbers. It is necessary on x86 systems + where double-floats are not IEEE compliant by default, to avoid that the + results become platform and compiler option dependent. 'volatile' is a + portable alternative to gcc's -ffloat-store option. */ +#define VOLATILE volatile +#define HUGEVAL HUGE_VAL +#define L_(literal) literal +#define MINUS_ZERO minus_zerod +#define MAX_EXP DBL_MAX_EXP +#define MIN_EXP DBL_MIN_EXP +#define MIN_NORMAL_EXP DBL_MIN_EXP +#define LOGB logb +#define RANDOM randomd +#include "test-logb.h" int main () { - /* Some particular values. */ - x = 0.6; - y = logb (x); - ASSERT (y == -1.0); - - x = 1.2; - y = logb (x); - ASSERT (y == 0.0); - - x = 2.1; - y = logb (x); - ASSERT (y == 1.0); - - x = 3.9; - y = logb (x); - ASSERT (y == 1.0); - - x = 4.0; - y = logb (x); - ASSERT (y == (FLT_RADIX == 2 ? 2.0 : 1.0)); - - x = 0.25; - y = logb (x); - ASSERT (y == (FLT_RADIX == 2 ? -2.0 : -1.0)); + test_function (); return 0; }