[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: |
Thu, 27 Oct 2022 15:22:25 -0400 (EDT) |
Update of bug #63089 (project octave):
Status: Ready For Test => Fixed
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #24:
After examining it further, I'd like to close this report as fixed for stable,
leaving the input duplication unchanged, at least for Octave 8.
The ideal call sequence would be:
* Both dec2bin and dec2hex would pass their arguments to dec2base, without any
significant input validation of their own (no code duplication).
* dec2base would do all input validation and call a private conversion
function.
* dec2base would need to at least accept negative inputs to accommodate
dec2bin and dec2hex, so that dec2bin doesn't have to duplicate that check and
validation -- this is a major change to dec2base internals.
* The above rules would implicitly make everything consistent.
* Whether dec2base grows in future to accept fractional inputs (or not), that
change would be local to dec2base's conversion routine, and the effect would
transparently show up for dec2bin and dec2hex.
I have a feature-complete WIP patch of dec2base that covers the points above
but the price is some ad hoc code duplication between dec2bin and dec2base,
since dec2bin accommodates negative inputs of certain fixed sizes and dec2base
does not.
I have a WIP to make everything fully consistent with no duplication, but
there is not enough time before default is merged to stable for testing
everything for Octave 8. I'd prefer leaving the current input validation code
duplication stand the way it is for now, and fix it without the time pressure.
I'll submit the WIP as a separate patch as a feature request ("accommodate
negative inputs for dec2base so that code duplication can be removed"). The
fractional inputs feature is optional and can be decided at that point.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63089>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16, Markus Mützel, 2022/10/24
- [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16, Nicholas Jankowski, 2022/10/24
- [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16, Arun Giridhar, 2022/10/24
- [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16, Markus Mützel, 2022/10/24
- [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16, Nicholas Jankowski, 2022/10/25
- [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16, Arun Giridhar, 2022/10/25
- [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16, Markus Mützel, 2022/10/25
- [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16, Arun Giridhar, 2022/10/25
- [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16, Markus Mützel, 2022/10/26
- [Octave-bug-tracker] [bug #63089] dec2bin gives wrong answer for negative int16,
Arun Giridhar <=