Background: I'm making a simple program that solves quadratic equations and completes the squares. Now, I have a few issues: 1. For some reason, when I do something like this (not actual code): Code: double a = 5/2; NSLog(@"%f", a); The output will be 2.000000, instead of 2.5. And this happens to any operation that has decimal points. It just rounds it down to an integer, depute being a type of Code: double . This gives invalid answers, and I need help. Please. 2. Since it solves quadratic equations, let's say is the answer is a whole number(probably 5). Since the answer variable is of type Code: double , it will output 5.000000. How do I make it do just 5? 3. I made it obtain the values from three separate UITextFields. As a result, the value was a string and so I had to set up a scanner to scan for the integers. Here is the code: Code: NSCharacterSet* charSet = [NSCharacterSet decimalDigitCharacterSet]; NSScanner* aScanner = [NSScanner scannerWithString:self.aValue.text]; NSScanner* bScanner = [NSScanner scannerWithString:self.bValue.text]; NSScanner* cScanner = [NSScanner scannerWithString:self.cValue.text]; [aScanner scanUpToCharactersFromSet:charSet intoString:nil]; [bScanner scanUpToCharactersFromSet:charSet intoString:nil]; [cScanner scanUpToCharactersFromSet:charSet intoString:nil]; [aScanner scanInt:&aVal]; [bScanner scanInt:&bVal]; [cScanner scanInt:&cVal]; This code is fair enough, and works fine for positive values. As you can imagine, if the user enters a negative value, it will ignore it. How can I adjust this to scan for the sign also, so it can also work for negative values? Thank you for your time. I have attached the entire project file of you want to take a look.