# HG changeset patch # User Michael Godfrey # Date 1361070419 18000 # Node ID 7cfb186592deb3afd2d7ee823a029187ab4aeba3 # Parent 821922270b66c35c6953c4441b36a24a8da573c0 Make signbit return logical 0 or 1 (bug #38291) * libinterp/corefcn/mappers.cc(Fsignbit): Return logical value (xsignbit != 0). diff -r 821922270b66 -r 7cfb186592de libinterp/corefcn/mappers.cc --- a/libinterp/corefcn/mappers.cc Wed Feb 20 14:58:39 2013 -0800 +++ b/libinterp/corefcn/mappers.cc Sat Feb 16 22:06:59 2013 -0500 @@ -1882,7 +1882,10 @@ DEFUNX ("signbit", Fsignbit, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} signbit (@var{x})\n\ -Return a nonzero value if the value of @var{x} has its sign bit set.\n\ +Return logical true if the value of @var{x} has its sign bit set.\n\ +Otherwise return logical false. This behavior is consistent with the other\n\ +logical functions. See@ref{Logical Values}. The behavior differs from the\n\ +C language function which returns non-zero if the sign bit is set.\n\ \n\ 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\ @@ -1891,8 +1894,9 @@ @end deftypefn") { octave_value retval; - if (args.length () == 1) + if (args.length () == 1) { retval = args(0).xsignbit (); + retval = (retval != 0); } else print_usage ();