comparison libinterp/corefcn/mappers.cc @ 15488:481417a57a2d

improve sign and signbit docs * mappers.cc (Fsign): Note sign (-0) is 0. Add @seealso for signbit. (Fsignbit): Add @seealso for sign.
author John W. Eaton <jwe@octave.org>
date Thu, 04 Oct 2012 10:20:59 -0400
parents ecf5be238b4a
children 96b7343b8a41
comparison
equal deleted inserted replaced
15487:ecf5be238b4a 15488:481417a57a2d
1752 @end example\n\ 1752 @end example\n\
1753 \n\ 1753 \n\
1754 @end ifnottex\n\ 1754 @end ifnottex\n\
1755 \n\ 1755 \n\
1756 For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.\n\ 1756 For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.\n\
1757 \n\
1758 Note that @code{sign (-0.0)} is 0.\n\ Although IEEE 754 floating point\n\
1759 allows zero to be signed, 0.0 and -0.0 compare equal. If you must test\n\
1760 whether zero is signed, use the @code{signbit} function.\n\
1761 @seealso{signbit}\n\
1757 @end deftypefn") 1762 @end deftypefn")
1758 { 1763 {
1759 octave_value retval; 1764 octave_value retval;
1760 if (args.length () == 1) 1765 if (args.length () == 1)
1761 retval = args(0).signum (); 1766 retval = args(0).signum ();
1786 Return a nonzero value if the value of @var{x} has its sign bit set.\n\ 1791 Return a nonzero value if the value of @var{x} has its sign bit set.\n\
1787 \n\ 1792 \n\
1788 This is not the same as @code{x < 0.0}, because IEEE 754 floating point\n\ 1793 This is not the same as @code{x < 0.0}, because IEEE 754 floating point\n\
1789 allows zero to be signed. The comparison @code{-0.0 < 0.0} is false,\n\ 1794 allows zero to be signed. The comparison @code{-0.0 < 0.0} is false,\n\
1790 but @code{signbit (-0.0)} will return a nonzero value.\n\ 1795 but @code{signbit (-0.0)} will return a nonzero value.\n\
1796 @seealso{sign}\n\
1791 @end deftypefn") 1797 @end deftypefn")
1792 { 1798 {
1793 octave_value retval; 1799 octave_value retval;
1794 if (args.length () == 1) 1800 if (args.length () == 1)
1795 retval = args(0).xsignbit (); 1801 retval = args(0).xsignbit ();