Hi, I'm new to Objective C and just trying a few things out with it. Please can someone tell me whay this gives the wrong answer:
int diam;
float pi;
float circ;
pi=3.14;
diam=15;
circ=pi*diam;
circ should equal 47.1, when running the program, circ actually equals 47.1000023 !!!
If I change circ and pi to doubles, the answer is 47.100000000000001 !!!
Why is this happeneing?
int diam;
float pi;
float circ;
pi=3.14;
diam=15;
circ=pi*diam;
circ should equal 47.1, when running the program, circ actually equals 47.1000023 !!!
If I change circ and pi to doubles, the answer is 47.100000000000001 !!!
Why is this happeneing?