Print this page
11210 libm should be cstyle(1ONBLD) clean
@@ -20,10 +20,11 @@
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -40,31 +41,36 @@
#include "libm.h"
#include "longdouble.h"
static const long double qone = 1.0L;
-
long double
-ceill(long double x) {
+ceill(long double x)
+{
long double t;
if (!finitel(x))
return (x + x);
+
t = rintl(x);
+
if (t >= x) /* already ceil(x) */
return (t);
else /* t < x case: return t+1 */
return (copysignl(t + qone, x));
}
long double
-floorl(long double x) {
+floorl(long double x)
+{
long double t;
if (!finitel(x))
return (x + x);
+
t = rintl(x);
+
if (t <= x)
return (t); /* already floor(x) */
else /* x < t case: return t-1 */
return (copysignl(t - qone, x));
}