[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-intege
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not |
Date: |
Fri, 18 Dec 2020 11:57:07 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36 |
Update of bug #59719 (project octave):
Operating System: Microsoft Windows => Any
Summary: dec2bin does not work for real numbers (compared to
matlab) => dec2bin issues an error for non-integer inputs while Matlab does
not
_______________________________________________________
Follow-up Comment #1:
Octave is purposefully more strict than Matlab on input validation. It seeks
to prevent Garbage In / Garbage Out calculations that the programmer might not
have realized. For example, Matlab also does not translate floating point
numbers that are not integers. What it does instead it makes a particular
choice about how to transform floating point values to integers and it does
not inform the user that it is doing so. I think it is more useful to alert
the programmer that the data, which they expected to be integer, is not. Then
they can make an informed decision about how the transform should occur. Both
Matlab and Octave offer floor(), ceil(), fix(), and round() which accomplish
the transformation, but with different characteristics. It is up to the
programmer to decide on the best option for their data.
The use of "non-negative integers" to indicate the numbers [0, 1, 2, ...]
seems more accurate than "natural number" which I was not familiar with. I
looked it up on Wikipedia and I saw this, "Some definitions, including the
standard ISO 80000-2,[4][a] begin the natural numbers with 0, corresponding to
the non-negative integers 0, 1, 2, 3, ... (often collectively denoted by the
symbol N, or N0 for emphasizing that zero is included), whereas others start
with 1, corresponding to the positive integers 1, 2, 3, ... (sometimes
collectively denoted by the symbol N, or N1 for emphasizing that zero is
excluded)." So there is a potential confusion which is not present when using
"non-negative integers".
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59719>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #59719] dec2bin does not work for real numbers (compared to matlab), Peter Kempter, 2020/12/18
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not,
Rik <=
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not, Nicholas Jankowski, 2020/12/18
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not, Nicholas Jankowski, 2020/12/18
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not, Rik, 2020/12/18
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not, Nicholas Jankowski, 2020/12/18
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not, Rik, 2020/12/18
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not, Nicholas Jankowski, 2020/12/18
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not, Rik, 2020/12/18
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not, Nicholas Jankowski, 2020/12/18
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not, Nicholas Jankowski, 2020/12/18
- [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not, Peter Kempter, 2020/12/18