cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[basic.extended.fp] p6 The table lacks the introduction of the sign bit #433

Closed xmh0511 closed 1 year ago

xmh0511 commented 1 year ago

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

According to Wikipedia, for example binary32, it has three parts

  • Sign bit: 1 bit
  • Exponent width: 8 bits
  • Significand precision: 24 bits (23 explicitly stored)

However, the table just specifies two parts of them, that is:

  • p, precision in bits
  • w, exponent field width in bits
JohelEGP commented 1 year ago

See the note: https://eel.is/c++draft/basic.extended.fp#6.sentence-2.

The precision p includes the implicit 1 bit at the beginning of the mantissa, so the storage used for the mantissa is p−1 bits.

xmh0511 commented 1 year ago

See the note: https://eel.is/c++draft/basic.extended.fp#6.sentence-2.

The precision p includes the implicit 1 bit at the beginning of the mantissa, so the storage used for the mantissa is p−1 bits.

I meant the sign bit, which records the signedness of the value.

jensmaurer commented 1 year ago

The sign bit is constant everywhere, so there's nothing to show in the table. (The normative definition for these floating-point formats is in ISO/IEC/IEEE 60559 anyway, so we don't need to be complete here.)