PDA

View Full Version : Having problems with creating a calculator




daggoth
Jan 23, 2009, 11:09 PM
.



hiddenpremise
Jan 24, 2009, 07:20 PM
I'm about 99% sure that you would put in an exponent like 34*10^2

TotalLuck
Jan 24, 2009, 07:41 PM
(3.31 x 10e8 x + 2.01 x 10e7)
the 'e' can be lower or upper case

autorelease
Jan 25, 2009, 12:25 AM
(3.31 x 10e8 x + 2.01 x 10e7)
the 'e' can be lower or upper case

Actually, that's not correct. The 'e' means "times 10 to the power of", so if you say 10e8, you're actually saying "10 times 10 to the 8th power", which is 10 to the 9th power--not what you want.

You shouldn't use the multiplication operator at all: just type "3.3e8," "2.01e-7", etc.

mdeh
Jan 25, 2009, 12:48 AM
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

// insert code here...
NSLog(@"%g",(3.31e-8 + 2.01e-7) / (7.16e-6 + 2.01e-8) );
[pool drain];
return 0;
}

/* 0.032604 */

TotalLuck
Jan 25, 2009, 12:50 PM
I was only showing the notation not correcting what i "thought" he meant by his expression.