Skip to content

CWG2626 [basic.fundamental] The base-2 representation vs. value representation for integer types #131

@xmh0511

Description

@xmh0511

Full name of submitter (unless configured in github; will be published with the issue): Jim X

[basic.fundamental] p3 says

For each value x of a signed integer type, the value of the corresponding unsigned integer type congruent to x modulo 2N has the same value of corresponding bits in its value representation.

[basic.fundamental] p5 says

Each value x of an unsigned integer type with width N has a unique representation x= x020 + x121 + ... + xN-12N-1 where each coefficient xi is either 0 or 1; this is called the base-2 representation of x.

The base-2 representation of a value of signed integer type is the base-2 representation of the congruent value of the corresponding unsigned integer type.

Such two phrases(the first and the latest) essentially imply they convey the same things. In other words, they indicate that the value representation of an integer type is represented by the particular sequence of the coefficients in the base-2 representation of the value. In short, each bit in the value representation is the value of the corresponding coefficient.

Suggested resolution

Should we make the implication apparent in the clause? Consider the big/little endian, we may say

The value representation of a value of an integer type is an implementation-defined sequence of bits whose values are taken from the coefficients of the base-2 representation of that value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions