I'm trying to display very small double value on a TextField
. For example, doCalculationForEqualPressed
function returns 0.00008, but when I display it on a text field it shows a exponential record (8e-05). I don't need the number to be shown in exponential view. How to set the precision when to use exponential record ???
Using specifier %.9g - doesn't help.
double result;
result = [self.brain doCalculationForEqualPressed:[self.brain operationArray]];
if (result == INFINITY || result == -INFINITY || isnan(result)){
NSString *infinity = @"\u221E";
self.displayField.text = [NSString stringWithFormat:@"%@", infinity];
}
else
self.displayField.text = [NSString stringWithFormat:@"%.9g", result];