Iphones math support

Discussion in 'iOS Programming' started by hoosierfan24, Feb 10, 2010.

  1. hoosierfan24 macrumors member

    Joined:
    Jul 31, 2009
    #1
    hello i was thinking of doing an application that involves a lot of math, i was curious how much math the iphone supports
     
  2. bredell macrumors regular

    Joined:
    Mar 30, 2008
    Location:
    Uppsala, Sweden
    #2
    Check out the manual page for math(3), it has a list of supported functions. In a terminal window give the command "man math", or search for "math(3)" in the Xcode help.

    Edit: I found a link
     
  3. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #3
    What kind of math?

    I see about 40 MFlops of float double arithmetic performance (mostly adds and multiplies) from generic compiled C. Single precision floats can be even faster. And with VFP asm on a 3G or NEON asm on a 3GS you can get even more performance.
     
  4. sushi Moderator emeritus

    sushi

    Joined:
    Jul 19, 2002
    Location:
    キャンプスワ&#
    #4
    Or take a quick look at the app store under calculators to get a feel for what can be done.
     
  5. Whab macrumors newbie

    Joined:
    Mar 13, 2009
    Location:
    Montreal
    #5
    There is no limitation in the kind of math you can do on the iPhone. It's up to you to program efficient algorithms to compute the math. For example, we have developed 2 graphing apps that involve the computation of arbitrary complex math expressions to display them as 1D graph ("Math Graphing") or 2D images ("Patterns"). The iPhone and iPod touch are definitely fast enough to perform quite complex math operations.
     
  6. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #6
    There is a limit, but it's fairly high. You can get 10's (to potentially a few 100's) of megaflops from an iPhone, a few gigaflops from a fast PC, and closer to the teraflop rankings from a corporate compute center.

    There's also battery life to consider if the math needs to crunch for hours.

    But an iPhone is fast enough even for people who do really clueless idiotic things, such as recalculate a double precision transcendental math function for each audio sample inside a real-time audio callback. (Strongly not recommended.)
     
  7. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #7
    uh oh. lol. can you give me an example of what that might be 'cause i might be doing that in order to add sine wave based vibrato and tremolo animations to my sound's pitch. :eek:
     
  8. hoosierfan24 thread starter macrumors member

    Joined:
    Jul 31, 2009
  9. rarindeed macrumors newbie

    Joined:
    Dec 28, 2009
    #9
    I've used GSL for matrix operations in the iPhone before... particularly for DSP :p
     

Share This Page