mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-11 02:54:30 +08:00
re PR fortran/31202 (Incorrect rounding generated for NINT)
2007-08-05 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR fortran/31202 * intrinsics/c99_functions.c (roundl): Provide fallback implementation for systems without ceill. * c99_protos.h (roundl): Define prototype in all cases. From-SVN: r127227
This commit is contained in:
parent
9dfbac5b94
commit
c120ef140a
@ -1,3 +1,10 @@
|
|||||||
|
2007-08-05 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR fortran/31202
|
||||||
|
* intrinsics/c99_functions.c (roundl): Provide fallback
|
||||||
|
implementation for systems without ceill.
|
||||||
|
* c99_protos.h (roundl): Define prototype in all cases.
|
||||||
|
|
||||||
2007-08-03 Thomas Koenig <tkoenig@gcc.gnu.org>
|
2007-08-03 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||||
|
|
||||||
PR libfortran/32977
|
PR libfortran/32977
|
||||||
|
@ -200,7 +200,7 @@ extern double round(double);
|
|||||||
extern float roundf(float);
|
extern float roundf(float);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_ROUNDL) && defined(HAVE_CEILL)
|
#if !defined(HAVE_ROUNDL)
|
||||||
#define HAVE_ROUNDL 1
|
#define HAVE_ROUNDL 1
|
||||||
extern long double roundl(long double);
|
extern long double roundl(long double);
|
||||||
#endif
|
#endif
|
||||||
|
@ -500,8 +500,9 @@ powf(float x, float y)
|
|||||||
|
|
||||||
/* Algorithm by Steven G. Kargl. */
|
/* Algorithm by Steven G. Kargl. */
|
||||||
|
|
||||||
#if !defined(HAVE_ROUNDL) && defined(HAVE_CEILL)
|
#if !defined(HAVE_ROUNDL)
|
||||||
#define HAVE_ROUNDL 1
|
#define HAVE_ROUNDL 1
|
||||||
|
#if defined(HAVE_CEILL)
|
||||||
/* Round to nearest integral value. If the argument is halfway between two
|
/* Round to nearest integral value. If the argument is halfway between two
|
||||||
integral values then round away from zero. */
|
integral values then round away from zero. */
|
||||||
|
|
||||||
@ -527,6 +528,27 @@ roundl(long double x)
|
|||||||
return (-t);
|
return (-t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Poor version of roundl for system that don't have ceill. */
|
||||||
|
long double
|
||||||
|
roundl(long double x)
|
||||||
|
{
|
||||||
|
if (x > DBL_MAX || x < -DBL_MAX)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_NEXTAFTERL
|
||||||
|
static long double prechalf = nexafterl (0.5L, LDBL_MAX);
|
||||||
|
#else
|
||||||
|
static long double prechalf = 0.5L;
|
||||||
|
#endif
|
||||||
|
return (GFC_INTEGER_LARGEST) (x + (x > 0 ? prechalf : -prechalf));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Use round(). */
|
||||||
|
return round((double) x);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_ROUND
|
#ifndef HAVE_ROUND
|
||||||
|
Loading…
Reference in New Issue
Block a user