/* Test of logb() function.
- Copyright (C) 2010-2011 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
#include <float.h>
+#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;
}