Mercurial > hg > octave-lyh
changeset 16075:7cfb186592de
Make signbit return logical 0 or 1 (bug #38291)
* libinterp/corefcn/mappers.cc(Fsignbit): Return logical
value (xsignbit != 0).
author | Michael Godfrey <michaeldgodfrey@gmail.com> |
---|---|
date | Sat, 16 Feb 2013 22:06:59 -0500 |
parents | 821922270b66 |
children | c90c9623b20f |
files | libinterp/corefcn/mappers.cc |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/mappers.cc +++ b/libinterp/corefcn/mappers.cc @@ -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 ();