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: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #59719] dec2bin issues an error for non-integer inputs while Matlab does not
Date: Fri, 18 Dec 2020 13:30:32 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36

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

just for compatibility reference, the Matlab public facing help does
explicitly say that:


D — Input array
numeric array
Input array, specified as a numeric array.

If D is an array of floating-point numbers, and any element of D has a
fractional part, then dec2bin truncates it before conversion. For example,
dec2bin converts both 12 and 12.5 to '1100'. The truncation is always to the
nearest integer less than or equal to that element.

If D is a character or logical array, then dec2bin treats the elements of D as
integers. However, dec2bin treats characters as their Unicode® values, so
specifying D as a character array is not recommended.

Since R2020a

D can include negative numbers. The function converts negative numbers using
their two's complement binary values.


https://www.mathworks.com/help/matlab/ref/dec2bin.html#mw_5d4ea126-4d83-4079-b235-06df2797ee10

    _______________________________________________________

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]