login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #379 acos(1.0::Complex Float) fails revision 1 of 3

1 2 3
Editor:
Time: 2007/11/17 22:34:58 GMT-8
Note:

changed:
-
The acos and asin functions both fail when given a Complex Float
argument with the value 1.0.  The error message is:

<pre>
   >> Error detected within library code:
   catdef: division by zero
</pre>

Presumably the problem is on line 162 of trigcat.spad, which reads:

<pre>
       asin x == atan(x/sqrt(1-x**2))
</pre>

Obviously, if x = 1.0, then sqrt(1-x**2) will evaluate to 0.0, resulting
in division by zero.  The code should probably include an explicit check
for this case:

<pre>
       asin x == if x = 1.0 then pi()/2 else atan(x/sqrt(1-x**2))
</pre>


Submitted by : (unknown) at: 2007-11-17T22:34:58-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

The acos and asin functions both fail when given a Complex Float argument with the value 1.0. The error message is:

   >> Error detected within library code:
   catdef: division by zero

Presumably the problem is on line 162 of trigcat.spad, which reads:

       asin x == atan(x/sqrt(1-x**2))

Obviously, if x = 1.0, then sqrt(1-x**2) will evaluate to 0.0, resulting in division by zero. The code should probably include an explicit check for this case:

       asin x == if x = 1.0 then pi()/2 else atan(x/sqrt(1-x**2))