Mercurial > octave
changeset 31850:43d56bbe9d40
maint: Use consistent spacing in dec2base.m
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Fri, 24 Feb 2023 16:46:43 -0500 |
parents | a098cc74d9a5 |
children | 2c9418209425 |
files | scripts/strings/dec2base.m |
diffstat | 1 files changed, 8 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/strings/dec2base.m Fri Feb 24 14:12:47 2023 -0500 +++ b/scripts/strings/dec2base.m Fri Feb 24 16:46:43 2023 -0500 @@ -110,9 +110,9 @@ ## Note which elements are negative for processing later. ## This also needs special processing for the corresponding intmax. - belowlim = false(size(d)); + belowlim = false (size (d)); if (isinteger (d)) - belowlim = (d <= intmin(class(d))); + belowlim = (d <= intmin (class (d))); endif neg = (d < 0); d(neg) = -d(neg); @@ -145,30 +145,28 @@ max_len = max (max_len, len); endif - ## determine digits for each number + ## Determine digits for each number digits = zeros (numel (d), max_len); for k = max_len:-1:1 - digits(:,k) = mod (d, base); - d = round ((d - digits(:,k)) / base); + digits(:, k) = mod (d, base); + d = round ((d - digits(:, k)) / base); endfor ## Compute any fractional part and append + digits2 = zeros (rows (digits), decimals); if (nargin == 4 && decimals > 0) - digits2 = zeros (numel (d), decimals); for k = 1:decimals fracpart *= base; - digits2(:,k) = floor (fracpart); + digits2(:, k) = floor (fracpart); fracpart -= floor (fracpart); endfor - else - digits2 = zeros (rows (digits), 0); endif ## Handle negative inputs now for k = find (neg)(:)' digits(k, :) = (base-1) - digits(k, :); if (! isempty (digits2)) - digits2 (k, :) = (base-1) - digits2 (k, :); + digits2(k, :) = (base - 1) - digits2(k, :); endif if (! isempty (digits2))