Having problems with creating a calculator

Discussion in 'Mac Programming' started by daggoth, Jan 23, 2009.

  1. hiddenpremise macrumors regular

    hiddenpremise

    Joined:
    Jul 25, 2008
    Location:
    Somewhere between my imagination and reality
    #2
    I'm about 99% sure that you would put in an exponent like 34*10^2
     
  2. TotalLuck macrumors newbie

    TotalLuck

    Joined:
    Jan 3, 2009
    Location:
    Moreno Vallley
    #3
    from the kochan bok

    (3.31 x 10e8 x + 2.01 x 10e7)
    the 'e' can be lower or upper case
     
  3. autorelease macrumors regular

    Joined:
    Oct 13, 2008
    Location:
    Achewood, CA
    #4
    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.
     
  4. mdeh macrumors 6502

    Joined:
    Jan 3, 2009
    #5
    #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 */
     
  5. TotalLuck macrumors newbie

    TotalLuck

    Joined:
    Jan 3, 2009
    Location:
    Moreno Vallley
    #6
    right

    I was only showing the notation not correcting what i "thought" he meant by his expression.
     

Share This Page