posted 16 years ago
hi friends,
in this piece of code:
output:
(int)d : -2
absolute val of d: 2.9
(int)absolute val: 2
i*= (int)(Math.abs(d): -4
(int)(-2* Math.abs(d)) : -5
i thought the last two statements would give the same output...
but looks like in the *= statement does the cast on each element and then gives the output... while the last statement does the cast on the whole result...
is this how it is supposed to happen?... i always thought the cast is performed after the operands are evaluated.. am i wrong?
thanks in advance