BuffaloEngineer
Member
If I'm doing math with different variable types, can I run into trouble? For example, if I'm doing:
A = B * C; or
A = B / C;
If A is a long, and B and C are a char and an int, is it possible to get the wrong result because I mixed variable types? (Assuming I've done my due diligence, i.e. B * C < 2^32)
Is this considered poor practice? Is it best to cast them all as longs before performing these operations? Thanks!
A = B * C; or
A = B / C;
If A is a long, and B and C are a char and an int, is it possible to get the wrong result because I mixed variable types? (Assuming I've done my due diligence, i.e. B * C < 2^32)
Is this considered poor practice? Is it best to cast them all as longs before performing these operations? Thanks!