3 ms·
Ah shit, well I guess you found the 0.1%
by bobbylarrybobby 5y ago
Ah shit, well I guess you found the 0.1%
- adwn 5y agoYou think negative numbers in a signed type are a 1-in-a-1000 case, really? Silently casting signed integers to unsigned is a terrible idea, and a recipe for bugs. And completely unnecessary to boot, because you could promote Int8 to Int16, and (Int16, UInt16) to (Int32, Int32).
- astrange 5y agoRelated, an integer bug that can't be fixed in C is that "unsigned short" promotes to "int" instead of "unsigned int", so this doesn't produce the result you want. unsigned x = (unsigned short)65535 * (unsigned short)65535; (It overflows even though it's less than UINT_MAX, and worse it's UB.)
- kolbusa 5y agoThis is completely off topic here, but the first promotion of Int64 -> Float64 is also iffy as not every Int64 is exactly representable. The Int64 -> Float16 promotion also looks weird to me because Float16 range is so small