Or signed integers because overflow is undefined. It could do the left-hand computation in two’s complement and the right hand in sign-magnitude, leading to different results. Or, as it’s undefined, it could brew you some coffee and serve it with an aspirin.
That’s decidedly unfun and headhurty for those of us less mathemstically inclined. Also so deep into the theoretical weeds that I’m not sure that “fact” applies…
One night I dreamt about the new C standard. It was a tome of ten thousand pages, in dense, tiny, font, three columns of text on each page, and it was all headings and sub-headings interspersed with nothing but either “undefined” or “implementation-defined”.
Fun fact: C doesn’t even guarantee
a + b == a + b
*If a and b are
float
Or signed integers because overflow is undefined. It could do the left-hand computation in two’s complement and the right hand in sign-magnitude, leading to different results. Or, as it’s undefined, it could brew you some coffee and serve it with an aspirin.
That’s decidedly unfun and headhurty for those of us less mathemstically inclined. Also so deep into the theoretical weeds that I’m not sure that “fact” applies…
One night I dreamt about the new C standard. It was a tome of ten thousand pages, in dense, tiny, font, three columns of text on each page, and it was all headings and sub-headings interspersed with nothing but either “undefined” or “implementation-defined”.
C doesn’t even guarantee a == a