diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2011-11-08 10:31:04 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2011-11-08 10:31:04 +0000 |
commit | 287188ea072dd887a17dd56360531c3a22307e7c (patch) | |
tree | fe52eb52fcdb9b2998fc1a82fc43d1a99450426d /libgfortran/intrinsics | |
parent | 7d29c953afdd7232bf34cb40eaf28511692b3e77 (diff) | |
download | gcc-287188ea072dd887a17dd56360531c3a22307e7c.zip gcc-287188ea072dd887a17dd56360531c3a22307e7c.tar.gz gcc-287188ea072dd887a17dd56360531c3a22307e7c.tar.bz2 |
re PR libfortran/47970 (c99_functions.c:611:5: warning: implicit declaration of function 'round')
PR libfortran/47970
* intrinsics/c99_functions.c (round): Move higher in the file.
From-SVN: r181153
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r-- | libgfortran/intrinsics/c99_functions.c | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/libgfortran/intrinsics/c99_functions.c b/libgfortran/intrinsics/c99_functions.c index 9ba5544..a95f09a 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 |