[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #49192] dec2bin function does not behave the s
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #49192] dec2bin function does not behave the same as Matlab |
Date: |
Tue, 27 Sep 2016 17:44:05 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 |
Update of bug #49192 (project octave):
Priority: 3 - Low => 5 - Normal
Item Group: WTF, Matlab?!? => Matlab Compatibility
Status: Wont Fix => None
Release: 4.2.0-rc2 => 4.0.2
Operating System: Any => Microsoft Windows
_______________________________________________________
Follow-up Comment #3:
This seems like an odd choice by Matlab. According to their own
documentation:
str = dec2bin(d,n) produces a binary representation with at least n bits.
So using n == 0 should imply that the result in binary will have 0 or more
digits. Given that the decimal number 0 can be represented in binary by the
decimal digit '0' it seems like the answer should have exactly one digit.
Just for fun, what does Matlab do for the following?
dec2bin (5, 0)
dec2bin (0, 3)
Octave's results are
octave:3> dec2bin (5, 0)
ans = 101
octave:4> dec2bin (0, 3)
ans = 000
which makes sense to me.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?49192>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/