octave-bug-tracker
[Top][All Lists]
Advanced

[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 14:31:51 -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

Follow-up Comment #6, bug #59719 (project octave):

This is in keeping with Matlab.  They have such a long history, and such a
strong desire to keep new versions of Matlab backward-compatible with existing
scripts, that they often choose to lock-in strange design choices.  It would
be clearer if all base conversion routines either issued an error, or all
converted non-integer portions to zero in the same way.  Instead they've got a
mix.  I think Octave should continue with just issuing an error and letting
the programmer resolve the issue.  The generated code for this, say


x = floor (x);
y = dec2bin (x);


is *guaranteed* to work on both Matlab and Octave and is thus clearer and
platform-agnostic.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59719>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]