* tests/test-fabs.c: Include <string.h>, minus-zero.h.
(zero): New variable.
(main): Add tests for signed zero.
* modules/fabs-tests (Files): Add tests/minus-zero.h.
2012-02-25 Bruno Haible <bruno@clisp.org>
+ fabs tests: More tests.
+ * tests/test-fabs.c: Include <string.h>, minus-zero.h.
+ (zero): New variable.
+ (main): Add tests for signed zero.
+ * modules/fabs-tests (Files): Add tests/minus-zero.h.
+
fabsf tests: More tests.
* tests/test-fabsf.c: Include <string.h>, minus-zero.h.
(zero): New variable.
Files:
tests/test-fabs.c
tests/signature.h
+tests/minus-zero.h
tests/macros.h
Depends-on:
#include "signature.h"
SIGNATURE_CHECK (fabs, double, (double));
+#include <string.h>
+
#include "macros.h"
+#include "minus-zero.h"
volatile double x;
double y;
+double zero = 0.0;
int
main ()
y = fabs (x);
ASSERT (y == 0.6);
+ /* Signed zero. */
+ x = 0.0;
+ y = fabs (x);
+ ASSERT (y == 0.0);
+ ASSERT (memcmp (&y, &zero, sizeof y) == 0);
+
+ x = minus_zerod;
+ y = fabs (x);
+ ASSERT (y == 0.0);
+ ASSERT (memcmp (&y, &zero, sizeof y) == 0);
+
return 0;
}