diff options
author | Eric Botcazou <ebotcazou@libertysurf.fr> | 2005-05-21 08:44:50 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2005-05-21 06:44:50 +0000 |
commit | 69a2d125d6071769f9ae2b98d35b0e2c4674d935 (patch) | |
tree | e0800c58d9a0cf8ee2e6fb295ce7e5093a94bfd1 /libgfortran/intrinsics/c99_functions.c | |
parent | 542b52ddb28497f5888a56fbf240cb40c7146714 (diff) | |
download | gcc-69a2d125d6071769f9ae2b98d35b0e2c4674d935.zip gcc-69a2d125d6071769f9ae2b98d35b0e2c4674d935.tar.gz gcc-69a2d125d6071769f9ae2b98d35b0e2c4674d935.tar.bz2 |
configure.ac: Check for trunc and truncf in libm.
* configure.ac: Check for trunc and truncf in libm.
* configure: Regenerate.
* config.h.in: Likewise.
* intrinsics/c99_functions.c (trunc, truncf): New functions.
* c99_protos.h (trunc, truncf): Declare them.
From-SVN: r100040
Diffstat (limited to 'libgfortran/intrinsics/c99_functions.c')
-rw-r--r-- | libgfortran/intrinsics/c99_functions.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libgfortran/intrinsics/c99_functions.c b/libgfortran/intrinsics/c99_functions.c index f7dc977..6296904 100644 --- a/libgfortran/intrinsics/c99_functions.c +++ b/libgfortran/intrinsics/c99_functions.c @@ -202,6 +202,28 @@ tanhf(float x) } #endif +#ifndef HAVE_TRUNC +double +trunc(double x) +{ + if (!isfinite (x)) + return x; + + if (x < 0.0) + return - floor (-x); + else + return floor (x); +} +#endif + +#ifndef HAVE_TRUNCF +float +truncf(float x) +{ + return (float) trunc (x); +} +#endif + #ifndef HAVE_NEXTAFTERF /* This is a portable implementation of nextafterf that is intended to be independent of the floating point format or its in memory representation. |