Print this page
11210 libm should be cstyle(1ONBLD) clean
@@ -16,13 +16,15 @@
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
+
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -31,22 +33,26 @@
#include "libm.h"
extern int signgam;
double
-gamma(double x) {
+gamma(double x)
+{
double g;
if (!finite(x))
return (x * x);
g = rint(x);
+
if (x == g && x <= 0.0) {
signgam = 1;
return (_SVID_libm_err(x, x, 41));
}
g = __k_lgamma(x, &signgam);
+
if (!finite(g))
g = _SVID_libm_err(x, x, 40);
+
return (g);
}