This..

uint32_t DAC; uint16_t dist,span,zero; span = 1000; zero = 50; DAC = 255*(dist-zero)/(span-zero);

with this...

uint32_t DAC; uint16_t dist,span,zero; span = 1000; zero = 50; DAC = (dist-zero); DAC *=255; DAC /= (span-zero);

both of them gave different result, the last one is the correct one. Theoretically both of them have the same meaning but produce different code size and check sum. Sorry, i don't see the assembly output.

Any explanation? Please, simple one.

Thanks.