diff Modules/mathmodule.c @ 44440:6208b17d0dbe legacy-trunk

Added copysign(x, y) function to the math module
author Christian Heimes <christian@cheimes.de>
date Thu, 03 Jan 2008 22:32:26 +0000
parents 968bda81e6c8
children cba9ff760430
line wrap: on
line diff
--- a/Modules/mathmodule.c	Thu Jan 03 22:16:32 2008 +0000
+++ b/Modules/mathmodule.c	Thu Jan 03 22:32:26 2008 +0000
@@ -133,6 +133,14 @@
       "cos(x)\n\nReturn the cosine of x (measured in radians).")
 FUNC1(cosh, cosh,
       "cosh(x)\n\nReturn the hyperbolic cosine of x.")
+#if defined(MS_WINDOWS) || defined(HAVE_COPYSIGN)
+#ifdef MS_WINDOWS
+FUNC2(copysign, _copysign,
+#else
+FUNC2(copysign, copysign,
+#endif
+    "copysign(x,y)\n\nReturn x with the sign of y.");
+#endif
 FUNC1(exp, exp,
       "exp(x)\n\nReturn e raised to the power of x.")
 FUNC1(fabs, fabs,
@@ -375,6 +383,9 @@
 	{"atan",	math_atan,	METH_O,		math_atan_doc},
 	{"atan2",	math_atan2,	METH_VARARGS,	math_atan2_doc},
 	{"ceil",	math_ceil,	METH_O,		math_ceil_doc},
+#if defined(MS_WINDOWS) || defined(HAVE_COPYSIGN)
+	{"copysign",	math_copysign,	METH_VARARGS,	math_copysign_doc},
+#endif
 	{"cos",		math_cos,	METH_O,		math_cos_doc},
 	{"cosh",	math_cosh,	METH_O,		math_cosh_doc},
 	{"degrees",	math_degrees,	METH_O,		math_degrees_doc},