diff libinterp/corefcn/mappers.cc @ 19730:554aaaf99644

Fix return phase of acosh to match Matlab (bug #44286). * NEWS: Announce change. * mappers.cc (Facosh): Add BIST tests for new behavior. * lo-mappers.cc: Re-write expression sqrt (x*x -1.0) as sqrt (x + 1.0) * sqrt (x - 1.0) which gets phase correct if x is complex.
author Rik <rik@octave.org>
date Tue, 17 Feb 2015 11:07:01 -0800
parents 4197fc428c7d
children 4f45eaf83908
line wrap: on
line diff
--- a/libinterp/corefcn/mappers.cc	Tue Feb 17 00:51:42 2015 -0500
+++ b/libinterp/corefcn/mappers.cc	Tue Feb 17 11:07:01 2015 -0800
@@ -155,10 +155,22 @@
 %! assert (acosh (x), v, sqrt (eps));
 
 %!test
+%! re = 2.99822295029797;
+%! im = pi/2;
+%! assert (acosh (10i), re + i*im);
+%! assert (acosh (-10i), re - i*im);
+
+%!test
 %! x = single ([1, 0, -1, 0]);
 %! v = single ([0, pi/2*i, pi*i, pi/2*i]);
 %! assert (acosh (x), v, sqrt (eps ("single")));
 
+%!test
+%! re = single (2.99822295029797);
+%! im = single (pi/2);
+%! assert (acosh (single (10i)), re + i*im, 5*eps ("single"));
+%! assert (acosh (single (-10i)), re - i*im, 5*eps ("single"));
+
 %!error acosh ()
 %!error acosh (1, 2)
 */