diff libinterp/corefcn/mappers.cc @ 17708:f10b7a578e2c

Correct return values of gamma() (see Numerical, item 3 on Projects page). * liboctave/numeric/lo-specfun.cc(xgamma): Check for special cases of NaN, -Inf, -integer and return NaN. Check for special case of 0 and return -Inf. * libinterp/corefcn/mappers.cc(Fgamma): Add %!tests for exceptional values.
author Craig Hudson <c_hudson_phd@hotmail.com>
date Tue, 02 Jul 2013 14:17:33 +0100
parents 12005245b645
children d63878346099
line wrap: on
line diff
--- a/libinterp/corefcn/mappers.cc	Sun Oct 20 23:43:26 2013 +0200
+++ b/libinterp/corefcn/mappers.cc	Tue Jul 02 14:17:33 2013 +0100
@@ -1056,8 +1056,9 @@
 %! assert (gamma (x), v, sqrt (eps ("single")));
 
 %!test
-%! x = [-1, 0, 1, Inf];
-%! v = [Inf, Inf, 1, Inf];
+%! ## Test exceptional values
+%! x = [-Inf, -1, -0, 0, 1, Inf, NaN];
+%! v = [NaN, NaN, -Inf, Inf, 1, Inf, NaN];
 %! assert (gamma (x), v);
 %! assert (gamma (single (x)), single (v));