changeset 3056:b08a007edd15

[project @ 1997-06-16 02:12:15 by jwe]
author jwe
date Mon, 16 Jun 1997 02:12:15 +0000
parents c4378ede0bec
children a35711deb8a5
files liboctave/ChangeLog liboctave/lo-mappers.cc
diffstat 2 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+Sun Jun 15 21:06:37 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* lo-mappers.cc (acos (const Complex&)): Select branch that is
+	compatible with Matlab.
+
 Tue Jun 10 10:58:05 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Array2-idx.h: Correctly handle empty matrices indexed by a
--- a/liboctave/lo-mappers.cc
+++ b/liboctave/lo-mappers.cc
@@ -231,45 +231,42 @@
 acos (const Complex& x)
 {
   static Complex i (0, 1);
-  Complex retval = -i * log (x + sqrt (x*x - 1.0));
-  return retval;
+
+  return (real (x) * imag (x) < 0.0) ? i * acosh (x) : -i * acosh (x);
 }
 
 Complex
 acosh (const Complex& x)
 {
-  Complex retval = log (x + sqrt (x*x - 1.0));
-  return retval;
+  return log (x + sqrt (x*x - 1.0));
 }
 
 Complex
 asin (const Complex& x)
 {
   static Complex i (0, 1);
-  Complex retval = -i * log (i*x + sqrt (1.0 - x*x));
-  return retval;
+
+  return -i * log (i*x + sqrt (1.0 - x*x));
 }
 
 Complex
 asinh (const Complex& x)
 {
-  Complex retval = log (x + sqrt (x*x + 1.0));
-  return retval;
+  return log (x + sqrt (x*x + 1.0));
 }
 
 Complex
 atan (const Complex& x)
 {
   static Complex i (0, 1);
-  Complex retval = i * log ((i + x) / (i - x)) / 2.0;
-  return retval;
+
+  return i * log ((i + x) / (i - x)) / 2.0;
 }
 
 Complex
 atanh (const Complex& x)
 {
-  Complex retval = log ((1 + x) / (1 - x)) / 2.0;
-  return retval;
+  return log ((1 + x) / (1 - x)) / 2.0;
 }
 
 Complex
@@ -311,15 +308,13 @@
 Complex
 tan (const Complex& x)
 {
-  Complex retval = sin (x) / cos (x);
-  return retval;
+  return sin (x) / cos (x);
 }
 
 Complex
 tanh (const Complex& x)
 {
-  Complex retval = sinh (x) / cosh (x);
-  return retval;
+  return sinh (x) / cosh (x);
 }
 
 /*