summaryrefslogtreecommitdiff
path: root/lib/floorl.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-10-05 03:33:31 +0200
committerBruno Haible <bruno@clisp.org>2007-10-05 03:33:31 +0200
commit33f47a8259736ab62fb8f2a3b548e2c0f67ddd97 (patch)
treeabe8aaf3c45aef58393d8c1a2b63c26f3ed31cfb /lib/floorl.c
parent8e4a7458b161eb2d65182f24119b17f395f2fbbe (diff)
downloadgnulib-33f47a8259736ab62fb8f2a3b548e2c0f67ddd97.tar.gz
New module 'floorl'.
Diffstat (limited to 'lib/floorl.c')
-rw-r--r--lib/floorl.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/lib/floorl.c b/lib/floorl.c
index 84b212e9e1..71d6b4f5b8 100644
--- a/lib/floorl.c
+++ b/lib/floorl.c
@@ -1,9 +1,5 @@
-/* Emulation for floorl.
- Contributed by Paolo Bonzini
-
- Copyright 2002, 2003, 2007 Free Software Foundation, Inc.
-
- This file is part of gnulib.
+/* Round towards negative 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
-floorl(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 "floor.c"