Consider the following code:
unsigned f( unsigned u )
{
return u / 10;
}
Surprisingly the compiler generates the following code from this:
mov eax, 0xcccccccd
mul ecx
shr edx, 3
mov eax, edx
ret
So why does this work, i.e. why aren't there rounding errors ?