Mercurial > octave
changeset 29197:1a3cb2e1644a
dec2bin.m: Add docstring note about fractional input incompatibility (bug #59719).
* dec2bin.m: Add Known Matlab Incompatibility note about fractional input
handling.
* dec2hex.m: Use "into" instead of "in to" in docstring.
author | Nicholas R. Jankowski <jankowskin@asme.org> |
---|---|
date | Fri, 18 Dec 2020 15:23:00 -0500 |
parents | 3332f1964e59 |
children | ec33b1617cd5 |
files | scripts/strings/dec2bin.m scripts/strings/dec2hex.m |
diffstat | 2 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/strings/dec2bin.m Thu Dec 17 17:57:50 2020 -0800 +++ b/scripts/strings/dec2bin.m Fri Dec 18 15:23:00 2020 -0500 @@ -49,9 +49,17 @@ ## @end group ## @end example ## -## Programming Notes: The largest negative value that can be converted in to +## Programming Notes: The largest negative value that can be converted into ## two's complement is @code{- (flintmax () / 2)}. ## +## Known @sc{matlab} Incompatibility: @sc{matlab}'s @code{dec2bin} allows +## non-integer values for @var{d}, truncating the value using the equivalent +## of @code{fix (@var{d})} for positive values, but, as of R2020b and in +## conflict with published documentation, appears to use +## @code{round (@var{d})} for negative values. To be consistent with +## @code{dec2hex} and @code{dec2base}, Octave produces an error for non-integer +## valued inputs for @var{d}. Users wanting compatible code for non-integer +## valued inputs should make use of @code{fix} or @code{round} as appropriate. ## @seealso{bin2dec, dec2base, dec2hex} ## @end deftypefn
--- a/scripts/strings/dec2hex.m Thu Dec 17 17:57:50 2020 -0800 +++ b/scripts/strings/dec2hex.m Fri Dec 18 15:23:00 2020 -0500 @@ -29,7 +29,8 @@ ## Return a string representing the conversion of the integer @var{d} to a ## hexadecimal (base16) number. ## -## If @var{d} is negative, return the two's complement binary value of @var{d}. +## If @var{d} is negative, return the hexadecimal equivalent of the two's +## complement binary value of @var{d}. ## If @var{d} is a matrix or cell array, return a string matrix with one row ## for each element in @var{d}, padded with leading zeros to the width of the ## largest value.