This is really weird, hopefully a fresh pair of eyes can help me figure this out. I happen to be using this code in an iPhone App, but I believe it's using simple C code so not sure this makes a difference or not. I have the user input a number (in this case the num will be 2.2). I then divide that number by 0.2.
On my calculator I get the answer of 11.
However, using the following code I get the answer of 10:
NSString *userNameFour = txtUserName4.text;
double numFour = [userNameFour intValue];
double t_psd = numFour/0.2;
so now when I print the variable t_psd
, I get 10.000000. What am I doing wrong here?