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

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

[Octave-bug-tracker] [bug #62212] Issues when casting large integers to


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #62212] Issues when casting large integers to floating point
Date: Wed, 30 Mar 2022 12:09:18 -0400 (EDT)

Follow-up Comment #19, bug #62212 (project octave):

I haven't checked the standard myself, but
https://en.cppreference.com/w/cpp/language/types says:

Prior to C++20, the C++ Standard allowed any signed integer representation,
and the minimum guaranteed range of N-bit signed integers was from
−(2N−1−1) to +2N−1−1

(e.g. -127 to 127 for a signed 8-bit type), which corresponds to the limits of
ones' complement or sign-and-magnitude.

However, all C++ compilers use two's complement representation, and as of
C++20, it is the only representation allowed by the standard, with the
guaranteed range from −2N−1
to +2N−1−1

(e.g. -128 to 127 for a signed 8-bit type).

8-bit ones' complement and sign-and-magnitude representations for char have
been disallowed since C++11 (via CWG 1759), because a UTF-8 code unit of value
0x80 used in a UTF-8 string literal must be storable in a char element object.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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