All operators on int
s return int
. So yes, 60 * 60 * 1000 / 1 * 1000 - 1
is an int
. But the expected result of 3599999999 is too big for an int
, so the expression actually evaluates to -694967297 (assuming 32-bit int
and two’s complement).
This doesn’t happen with a literal 3600000000
because integer literals larger than INT_MAX
are of a type that can hold the full value.