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

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

[Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong num


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #61788] arrays of type int16 contain wrong numbers
Date: Tue, 11 Jan 2022 11:47:08 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.55

Follow-up Comment #11, bug #61788 (project octave):

Most (or all?) platforms that Octave supports use two's complement for signed
integer. Could we use the overflow behavior of (un)signed C integers to make
this work?

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

§6.2.5 9:
> A computation involving unsigned operands can never overflow, because a
result that cannot be represented by the resulting unsigned integer type is
reduced modulo the number that is one greater than the largest value that can
be represented by the resulting type.

We could extend that specification to signed integers if we assume two's
complement...

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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