diff libinterp/corefcn/ellipj.cc @ 19200:068a3e51b7b8

ellipj: Fix continuity of dn output when cn is near zero (bug #43344) * lo-specfun.cc (ellipj): Fix continuity of the dn output, the current method results in a discontinuity when cn is near zero. * ellipj.cc: Add test for bug #43344.
author Mike Miller <mtmiller@ieee.org>
date Wed, 01 Oct 2014 22:39:04 -0400
parents 0850b5212619
children 4197fc428c7d
line wrap: on
line diff
--- a/libinterp/corefcn/ellipj.cc	Wed Oct 01 19:36:05 2014 +0100
+++ b/libinterp/corefcn/ellipj.cc	Wed Oct 01 22:39:04 2014 -0400
@@ -919,6 +919,15 @@
 %! assert (cn, C, 8*eps);
 %! assert (dn, D, 8*eps);
 
+%!test
+%! ## Test continuity of dn when cn is near zero (bug #43344)
+%! m = 0.5;
+%! u = ellipke (0.5);
+%! x = [-1e-3, -1e-12, 0, 1e-12, 1e-3];
+%! [~, ~, dn] = ellipj (u + x, m);
+%! D = 1/sqrt (2) * ones (size (x));
+%! assert (dn, D, 1e-6);
+
 %!error ellipj ()
 %!error ellipj (1)
 %!error ellipj (1,2,3,4)