Go Down

Topic: Simple math doing my head in - when is an int treated like an int? (Read 913 times) previous topic - next topic


Is this behaviour (intermediate calcs being influenced by data type of variable) just Arduino, or is it C?  Damn sure this has never happened to me in years of Java..?

C/C++ have that issue everywhere... Just try this anywhere =)

Code: [Select]

int foo = 20;
int bar = 35;
float baz = 0.0;

baz = foo / bar;

Go Up