projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support for MSVC compiler: Avoid division by a literal 0.
[gnulib.git]
/
tests
/
test-roundf1.c
diff --git
a/tests/test-roundf1.c
b/tests/test-roundf1.c
index
aeee3b1
..
8413e82
100644
(file)
--- a/
tests/test-roundf1.c
+++ b/
tests/test-roundf1.c
@@
-1,5
+1,5
@@
/* Test of rounding to nearest, breaking ties away from zero.
/* Test of rounding to nearest, breaking ties away from zero.
- Copyright (C) 2007
, 2008
Free Software Foundation, Inc.
+ Copyright (C) 2007
-2011
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
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
@@
-22,28
+22,21
@@
#include <math.h>
#include <math.h>
-#include
<stdio.h>
-#include <stdlib.h>
+#include
"signature.h"
+SIGNATURE_CHECK (roundf, float, (float));
-#include "isnanf.h"
-
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- abort (); \
- } \
- } \
- while (0)
+#include "isnanf-nolibm.h"
+#include "minus-zero.h"
+#include "infinity.h"
+#include "nan.h"
+#include "macros.h"
int
main ()
{
/* Zero. */
ASSERT (roundf (0.0f) == 0.0f);
int
main ()
{
/* Zero. */
ASSERT (roundf (0.0f) == 0.0f);
- ASSERT (roundf (
-0.0
f) == 0.0f);
+ ASSERT (roundf (
minus_zero
f) == 0.0f);
/* Positive numbers. */
ASSERT (roundf (0.3f) == 0.0f);
ASSERT (roundf (0.5f) == 1.0f);
/* Positive numbers. */
ASSERT (roundf (0.3f) == 0.0f);
ASSERT (roundf (0.5f) == 1.0f);
@@
-71,10
+64,10
@@
main ()
ASSERT (roundf (-65536.01f) == -65536.0f);
ASSERT (roundf (-2.341e31f) == -2.341e31f);
/* Infinite numbers. */
ASSERT (roundf (-65536.01f) == -65536.0f);
ASSERT (roundf (-2.341e31f) == -2.341e31f);
/* Infinite numbers. */
- ASSERT (roundf (
1.0 / 0.0f) == 1.0 / 0.0f
);
- ASSERT (roundf (-
1.0 / 0.0f) == -1.0 / 0.0f
);
+ ASSERT (roundf (
Infinityf ()) == Infinityf ()
);
+ ASSERT (roundf (-
Infinityf ()) == - Infinityf ()
);
/* NaNs. */
/* NaNs. */
- ASSERT (isnanf (roundf (N
AN
)));
+ ASSERT (isnanf (roundf (N
aNf ()
)));
return 0;
}
return 0;
}