Weird Calcul Error ?

edited November 2015 in Programming Questions

Here is my program:

size(300,300); background(255); fill(0);

float a, b;

a = 575 * 2 / 100; b = 575 / 100 * 2;

text(str(a),10,20); text(str(b),100,20); println(a); println(b);

I should read 11.5 and 11.5, but i read 11 and 10. I guess a rounding using "/100", but why i just want to divide by 100. I guess something very simple behind that weird calcul error, but i can't find it !

Thank you

Tagged:

Answers

Sign In or Register to comment.