From a25368f150046137109aa8cf58cb85dc6bc234b5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 10 Oct 2011 01:07:15 +0200 Subject: roundl: Simplify for platforms where 'long double' == 'double'. * lib/roundl.c: Include . (roundl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function. * lib/round.c [!USE_LONG_DOUBLE]: Don't include a second time. * m4/roundl.m4 (gl_FUNC_ROUNDL): Require gl_LONG_DOUBLE_VS_DOUBLE. Determine ROUNDL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. * modules/roundl (Depends-on): Add round. Update conditions. --- lib/roundl.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'lib/roundl.c') diff --git a/lib/roundl.c b/lib/roundl.c index 28f3f6f5c8..9cf81db4c1 100644 --- a/lib/roundl.c +++ b/lib/roundl.c @@ -15,5 +15,22 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#define USE_LONG_DOUBLE -#include "round.c" +#include + +#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE + +/* Specification. */ +# include + +long double +roundl (long double x) +{ + return round (x); +} + +#else + +# define USE_LONG_DOUBLE +# include "round.c" + +#endif -- cgit v1.2.1