changeset 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 720a3bd76492
files libinterp/corefcn/mappers.cc
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/mappers.cc	Thu Oct 04 09:48:07 2012 -0400
+++ b/libinterp/corefcn/mappers.cc	Thu Oct 04 10:20:59 2012 -0400
@@ -1754,6 +1754,11 @@
 @end ifnottex\n\
 \n\
 For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.\n\
+\n\
+Note that @code{sign (-0.0)} is 0.\n\  Although IEEE 754 floating point\n\
+allows zero to be signed, 0.0 and -0.0 compare equal.  If you must test\n\
+whether zero is signed, use the @code{signbit} function.\n\
+@seealso{signbit}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -1788,6 +1793,7 @@
 This is not the same as @code{x < 0.0}, because IEEE 754 floating point\n\
 allows zero to be signed.  The comparison @code{-0.0 < 0.0} is false,\n\
 but @code{signbit (-0.0)} will return a nonzero value.\n\
+@seealso{sign}\n\
 @end deftypefn")
 {
   octave_value retval;