summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-08 10:31:04 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-08 10:31:04 +0000
commitbf09288ee7b5f264f28081a84fde4c6aa1ac5c82 (patch)
treefe52eb52fcdb9b2998fc1a82fc43d1a99450426d
parent7961105f7642980ba4a85841241949ed7173c61c (diff)
downloadppe42-gcc-bf09288ee7b5f264f28081a84fde4c6aa1ac5c82.tar.gz
ppe42-gcc-bf09288ee7b5f264f28081a84fde4c6aa1ac5c82.zip
PR libfortran/47970
* intrinsics/c99_functions.c (round): Move higher in the file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181153 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/intrinsics/c99_functions.c61
2 files changed, 36 insertions, 30 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 82538422db4..becb6012838 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR libfortran/47970
+ * intrinsics/c99_functions.c (round): Move higher in the file.
+
2011-11-07 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/45723
diff --git a/libgfortran/intrinsics/c99_functions.c b/libgfortran/intrinsics/c99_functions.c
index 9ba5544a02b..a95f09ac01d 100644
--- a/libgfortran/intrinsics/c99_functions.c
+++ b/libgfortran/intrinsics/c99_functions.c
@@ -559,6 +559,37 @@ powf (float x, float y)
#endif
+#ifndef HAVE_ROUND
+#define HAVE_ROUND 1
+/* Round to nearest integral value. If the argument is halfway between two
+ integral values then round away from zero. */
+double round (double x);
+
+double
+round (double x)
+{
+ double t;
+ if (!isfinite (x))
+ return (x);
+
+ if (x >= 0.0)
+ {
+ t = floor (x);
+ if (t - x <= -0.5)
+ t += 1.0;
+ return (t);
+ }
+ else
+ {
+ t = floor (-x);
+ if (t + x <= -0.5)
+ t += 1.0;
+ return (-t);
+ }
+}
+#endif
+
+
/* Algorithm by Steven G. Kargl. */
#if !defined(HAVE_ROUNDL)
@@ -614,36 +645,6 @@ roundl (long double x)
#endif
#endif
-#ifndef HAVE_ROUND
-#define HAVE_ROUND 1
-/* Round to nearest integral value. If the argument is halfway between two
- integral values then round away from zero. */
-double round (double x);
-
-double
-round (double x)
-{
- double t;
- if (!isfinite (x))
- return (x);
-
- if (x >= 0.0)
- {
- t = floor (x);
- if (t - x <= -0.5)
- t += 1.0;
- return (t);
- }
- else
- {
- t = floor (-x);
- if (t + x <= -0.5)
- t += 1.0;
- return (-t);
- }
-}
-#endif
-
#ifndef HAVE_ROUNDF
#define HAVE_ROUNDF 1
/* Round to nearest integral value. If the argument is halfway between two
OpenPOWER on IntegriCloud