[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negativ

From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16
Date: Sat, 24 Sep 2022 13:45:05 -0400 (EDT)

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

Improved patch attached (v2).

I activated several BISTs that had been commented out. All BISTs now pass.
I've fixed them to expect 64-bit strings instead of 53-bit ones, and to allow
numbers down to -2^63 without expecting an error.

The practice of left-padding with ones for negative inputs is standard two's
complement notation, but the practice of further left-padding that with zeroes
is not mathematically sound at all. Is Matlab still doing that or have they
fixed it to consistently left-pad with ones for all negative inputs? In any
case, I've added a note to the docstring explaining what to expect.

Since the domain of valid inputs has changed, should we mention this in NEWS?
If so, is it going into 7.3 or 8?

(file #53748)


Additional Item Attachment:

File name: dec2bin.patch_v2               Size:5 KB


Reply to this item at:


Message sent via Savannah

reply via email to

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