A little OT, but nonetheless

Discussion in 'Mac Programming' started by mdeh, Jan 8, 2009.

  1. mdeh macrumors 6502

    Joined:
    Jan 3, 2009
    #1
    Using "Special characters" in Xcode, I can do this:

    1 X 10³, but how can one do 1 X 10(negative)³ ?


    thanks
     
  2. dukebound85 macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #2
    1/10^3 if you cant simply type 1 x 10^(-3)

    then again, i dont program so dont believe what i say when it comes to programming lol
     
  3. autorelease macrumors regular

    Joined:
    Oct 13, 2008
    Location:
    Achewood, CA
    #3
    I hope you're not trying to use "1 X 10³" as a numeric literal in your code, since that's nowhere near correct.

    If you're using that in a string (e.g. as a prompt to the user) it's not a problem. If you want to use scientific notation to specify a value for a float or double, the proper syntax is 1e3. Also, in this way, 1x10^(-3) would be 1e-3. The "e" means "times 10 to the power of."
     
  4. mdeh thread starter macrumors 6502

    Joined:
    Jan 3, 2009
    #4
    NO, just trying to make a fancy string literal to use in NSLOG, but I guess that is why they came up with scientific notation.
     

Share This Page