comparison libinterp/corefcn/mappers.cc @ 19151:e09318118fd6

doc: Add note to gamma docstring about using gammaln when input is large. * gammainc.cc (Fgammainc): Change seealso link to gammaln from lgamma. * mappers.cc (Fgamma): Add note to docstring about using gammaln to preserve precision when input to gamma is large. * mappers.cc (Flgamma): Put gammaln first in docstring.
author Rik <rik@octave.org>
date Mon, 22 Sep 2014 20:25:21 -0700
parents a4c226a963c5
children ba7e42dea4b2
comparison
equal deleted inserted replaced
19150:adb102face2d 19151:e09318118fd6
1022 t=0\n\ 1022 t=0\n\
1023 @end group\n\ 1023 @end group\n\
1024 @end example\n\ 1024 @end example\n\
1025 \n\ 1025 \n\
1026 @end ifnottex\n\ 1026 @end ifnottex\n\
1027 @seealso{gammainc, lgamma}\n\ 1027 \n\
1028 Programming Note: The gamma function can grow quite large even for small\n\
1029 input values. In many cases it may be preferable to use the natural\n\
1030 logarithm of the gamma function (@code{gammaln}) in calculations to minimize\n\
1031 loss of precision. The final result is then\n\
1032 @code{exp (@var{result_using_gammaln}).}\n\
1033 @seealso{gammainc, gammaln, factorial}\n\
1028 @end deftypefn") 1034 @end deftypefn")
1029 { 1035 {
1030 octave_value retval; 1036 octave_value retval;
1031 if (args.length () == 1) 1037 if (args.length () == 1)
1032 retval = args(0).gamma (); 1038 retval = args(0).gamma ();
1572 %!error isxdigit (1, 2) 1578 %!error isxdigit (1, 2)
1573 */ 1579 */
1574 1580
1575 DEFUN (lgamma, args, , 1581 DEFUN (lgamma, args, ,
1576 "-*- texinfo -*-\n\ 1582 "-*- texinfo -*-\n\
1577 @deftypefn {Mapping Function} {} lgamma (@var{x})\n\ 1583 @deftypefn {Mapping Function} {} gammaln (@var{x})\n\
1578 @deftypefnx {Mapping Function} {} gammaln (@var{x})\n\ 1584 @deftypefnx {Mapping Function} {} lgamma (@var{x})\n\
1579 Return the natural logarithm of the gamma function of @var{x}.\n\ 1585 Return the natural logarithm of the gamma function of @var{x}.\n\
1580 @seealso{gamma, gammainc}\n\ 1586 @seealso{gamma, gammainc}\n\
1581 @end deftypefn") 1587 @end deftypefn")
1582 { 1588 {
1583 octave_value retval; 1589 octave_value retval;