summaryrefslogtreecommitdiff
path: root/lib/ceill.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-10-05 03:54:50 +0200
committerBruno Haible <bruno@clisp.org>2007-10-05 03:54:50 +0200
commitd23df56e2060a3f468b8c6b069c0b87f6c15b774 (patch)
tree619f259dbf3c737374ca38c44d76cbe0bb1905b7 /lib/ceill.c
parent9ae286b3b3918e354fafeaafd8082d37b7c90460 (diff)
downloadgnulib-d23df56e2060a3f468b8c6b069c0b87f6c15b774.tar.gz
New module 'ceill'.
Diffstat (limited to 'lib/ceill.c')
-rw-r--r--lib/ceill.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/lib/ceill.c b/lib/ceill.c
index 9eb1ba07c2..4c65cd2dfd 100644
--- a/lib/ceill.c
+++ b/lib/ceill.c
@@ -1,9 +1,5 @@
-/* Emulation for ceill.
- Contributed by Paolo Bonzini
-
- Copyright 2002, 2003, 2007 Free Software Foundation, Inc.
-
- This file is part of gnulib.
+/* Round towards positive infinity.
+ Copyright (C) 2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,28 +15,7 @@
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <config.h>
-
-/* Specification. */
-#include <math.h>
-
-#include <float.h>
-
-/* To compute the integer part of X, sum a big enough
- integer so that the precision of the floating point
- number is exactly 1. */
-
-long double
-ceill(long double x)
-{
- long double y;
- if (x < 0.0L)
- y = -(1.0L / LDBL_EPSILON - x - 1.0 / LDBL_EPSILON);
- else
- y = 1.0L / LDBL_EPSILON + x - 1.0 / LDBL_EPSILON;
+/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
- if (y < x)
- return y + 1.0L;
- else
- return y;
-}
+#define USE_LONG_DOUBLE
+#include "ceil.c"