A single word to explain numBits()

I I am trying to do a devil's advocate review of my list of attributes of floating point numbers prior to publication of the module that defines them.

Given a type T, say real(w), what is a single word to describe w, the result of `numBits(T);.

I have always called it width, of more precisely, said that a real(32) is 32-bits wide. Certainly when we refer to the bandwidth of a 32-bit bus, we say that the width of the bus is 32 bits, But maybe that is a different context.

The IEEE 754 standard says that a binary32 type has a length of 32 bits.

I was going to defer to the standard. Does that make sense? Just to cause a discussion, I am going to say I disagree. Does anybody else have anything to say?

For whatever reason, I usually refer to this conversationally in English as a "bit-width" as well. I'm not crazy about length (which suggests more of a linearly growing structure to me), but your mention of it makes me think size could be appropriate as well (plus: it's similar to sizeof() in C/C++; minus: there are many types in Chapel that support .size, and it typically corresponds to a logical size rather than a number of bits size, so there'd be a slight asymmetry, but perhaps an acceptable one).

-Brad

Thanks for the reply. Listening to the ideas in my own brain was becoming a death spiral.

While the standard uses length to refer to the encoding, it says that the binary interchange formats such as binary32 have a width of 32 bits.

Mind you, to allow introspection of a floating point datum, I then proceed to copy its bit pattern into an unsigned integral type which is technical its sign-magnitude representation of some width.

So we have an encoding with a length, a format with a width, and a representation with a width

And then the standard mixed everything up with statement like

Representations of floating-point data in the binary interchange formats are encoded in k bits in the
following three fields .....

And then the programmer comes along and wants to call the result, an encoding.

I think I will stick with width.

1 Like