comparison scripts/strings/dec2bin.m @ 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 d8318c12d903
children 7854d5752dd2
comparison
equal deleted inserted replaced
29196:3332f1964e59 29197:1a3cb2e1644a
47 ## dec2bin (-14) 47 ## dec2bin (-14)
48 ## @result{} "11110010" 48 ## @result{} "11110010"
49 ## @end group 49 ## @end group
50 ## @end example 50 ## @end example
51 ## 51 ##
52 ## Programming Notes: The largest negative value that can be converted in to 52 ## Programming Notes: The largest negative value that can be converted into
53 ## two's complement is @code{- (flintmax () / 2)}. 53 ## two's complement is @code{- (flintmax () / 2)}.
54 ## 54 ##
55 ## Known @sc{matlab} Incompatibility: @sc{matlab}'s @code{dec2bin} allows
56 ## non-integer values for @var{d}, truncating the value using the equivalent
57 ## of @code{fix (@var{d})} for positive values, but, as of R2020b and in
58 ## conflict with published documentation, appears to use
59 ## @code{round (@var{d})} for negative values. To be consistent with
60 ## @code{dec2hex} and @code{dec2base}, Octave produces an error for non-integer
61 ## valued inputs for @var{d}. Users wanting compatible code for non-integer
62 ## valued inputs should make use of @code{fix} or @code{round} as appropriate.
55 ## @seealso{bin2dec, dec2base, dec2hex} 63 ## @seealso{bin2dec, dec2base, dec2hex}
56 ## @end deftypefn 64 ## @end deftypefn
57 65
58 function b = dec2bin (d, len) 66 function b = dec2bin (d, len)
59 67