[pure-lang-svn] SF.net SVN: pure-lang:[557] pure/trunk/lib/math.pure
Status: Beta
Brought to you by:
agraef
|
From: <ag...@us...> - 2008-08-21 13:28:02
|
Revision: 557
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=557&view=rev
Author: agraef
Date: 2008-08-21 13:28:11 +0000 (Thu, 21 Aug 2008)
Log Message:
-----------
Properly deal with nan arguments in sqrt, log and hyperbolic functions. Reported by Eddie Rucker.
Modified Paths:
--------------
pure/trunk/lib/math.pure
Modified: pure/trunk/lib/math.pure
===================================================================
--- pure/trunk/lib/math.pure 2008-08-21 11:49:34 UTC (rev 556)
+++ pure/trunk/lib/math.pure 2008-08-21 13:28:11 UTC (rev 557)
@@ -32,15 +32,15 @@
extern double sqrt(double) = c_sqrt;
-sqrt x::double = c_sqrt x if x>=0;
+sqrt x::double = c_sqrt x if x>=0 || nanp x;
sqrt x::int | sqrt x::bigint = sqrt (double x);
/* Exponential function and logarithms. */
extern double exp(double), double log(double) = c_log;
-ln x::double = c_log x if x>=0.0;
-log x::double = c_log x/c_log 10.0 if x>=0.0;
+ln x::double = c_log x if x>=0.0 || nanp x;
+log x::double = c_log x/c_log 10.0 if x>=0.0 || nanp x;
exp x::int | exp x::bigint = exp (double x);
ln x::int | ln x::bigint = ln (double x);
@@ -79,8 +79,8 @@
extern double __asinh(double), double __acosh(double), double __atanh(double);
asinh x::double = __asinh x;
-acosh x::double = __acosh x if x>=1.0;
-atanh x::double = __atanh x if abs x<=1.0;
+acosh x::double = __acosh x if x>=1.0 || nanp x;
+atanh x::double = __atanh x if abs x<=1.0 || nanp x;
sinh x::int | sinh x::bigint = sinh (double x);
cosh x::int | cosh x::bigint = cosh (double x);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|