This question is for my own curiosity rather than any practical purpose.
If I understand correctly, Stata understands unsigned bytes (%1bu), which take values from 0 to 255, signed bytes (%1bs), which take values from -127 to 127, and "Stata bytes" (%1b), which take values from -127 to 100, plus 27 distinct missing codes. But there appear to be only 255 distinct values for the signed byte (and Stata byte). So what is the 256th value? Is it the value that would be represented by negative zero? And if so, how does Stata handle this value? Is it readable? Is it writable? I don't think Stata has the concept of NaN or negative zero, and I'm not sure what else it could be.
Alternatively, maybe %1bs uses two's complement, so the unaccounted-for value is the value that would be represented by -128?
I know that the floating point types are IEEE 754 compliant, so they must be able to store negative zero, but I don't think the byte types are required to do that by any standard.
If I understand correctly, Stata understands unsigned bytes (%1bu), which take values from 0 to 255, signed bytes (%1bs), which take values from -127 to 127, and "Stata bytes" (%1b), which take values from -127 to 100, plus 27 distinct missing codes. But there appear to be only 255 distinct values for the signed byte (and Stata byte). So what is the 256th value? Is it the value that would be represented by negative zero? And if so, how does Stata handle this value? Is it readable? Is it writable? I don't think Stata has the concept of NaN or negative zero, and I'm not sure what else it could be.
Alternatively, maybe %1bs uses two's complement, so the unaccounted-for value is the value that would be represented by -128?
I know that the floating point types are IEEE 754 compliant, so they must be able to store negative zero, but I don't think the byte types are required to do that by any standard.
Comment