[Scipy-svn] r3142 - trunk/Lib/special/cephes

scipy-svn@scip... scipy-svn@scip...
Mon Jul 2 10:25:58 CDT 2007


Author: cookedm
Date: 2007-07-02 10:25:56 -0500 (Mon, 02 Jul 2007)
New Revision: 3142

Modified:
   trunk/Lib/special/cephes/yn.c
Log:
special: for yn(n, x), for x < 0 return nan, for x = 0, return -inf


Modified: trunk/Lib/special/cephes/yn.c
===================================================================
--- trunk/Lib/special/cephes/yn.c	2007-07-02 13:00:55 UTC (rev 3141)
+++ trunk/Lib/special/cephes/yn.c	2007-07-02 15:25:56 UTC (rev 3142)
@@ -60,7 +60,10 @@
 #else
 double y0(), y1(), log();
 #endif
-extern double MAXNUM, MAXLOG;
+extern double MAXNUM, MAXLOG, INFINITY;
+#ifdef NANS
+extern double NAN;
+#endif
 
 double yn( n, x )
 int n;
@@ -87,10 +90,17 @@
 	return( sign * y1(x) );
 
 /* test for overflow */
-if( x <= 0.0 )
+if (x == 0.0) {
+    return -INFINITY;
+}
+else if( x < 0.0 )
 	{
 	mtherr( "yn", SING );
+#ifdef NANS
+        return (NAN);
+#else
 	return( -MAXNUM );
+#endif
 	}
 
 /* forward recurrence on n */



More information about the Scipy-svn mailing list