[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #59934] Unexpected complex result from acos
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #59934] Unexpected complex result from acos |
Date: |
Sun, 24 Jan 2021 14:52:48 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0 |
Follow-up Comment #1, bug #59934 (project octave):
This is done for Matlab compatibility. For |x| <= 1, acos(x) and asin(x) will
return their expected values as described in IEC 60559 or IEEE 754. But unlike
the standards, which require a domain error for |x| > 1, Matlab returns a
complex number as described in Example 1 here:
https://ximera.osu.edu/math/complexBook/complexBook/complexTrig/complexTrig
This is probably already known to anyone who came to Octave from a Matlab
background, but yes, it could be documented in acos and asin for new users.
Documentation patch here:
diff -r 7bb6a7cbb65e libinterp/corefcn/mappers.cc
--- a/libinterp/corefcn/mappers.cc Sat Jan 23 17:28:14 2021 +0100
+++ b/libinterp/corefcn/mappers.cc Sun Jan 24 14:50:55 2021 -0500
@@ -88,6 +88,7 @@
doc: /* -*- texinfo -*-
@deftypefn {} {} acos (@var{x})
Compute the inverse cosine in radians for each element of @var{x}.
+For |x| > 1, the return value will be complex.
@seealso{cos, acosd}
@end deftypefn */)
{
@@ -292,6 +293,7 @@
doc: /* -*- texinfo -*-
@deftypefn {} {} asin (@var{x})
Compute the inverse sine in radians for each element of @var{x}.
+For |x| > 1, the return value will be complex.
@seealso{sin, asind}
@end deftypefn */)
{
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59934>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/