What kind of logarithm functions / methods are available in objective-c / cocoa-touch?

后端 未结 3 740
死守一世寂寞
死守一世寂寞 2020-12-07 01:16

I\'ve tried searching for logarithm + objective-c, but all I get is math test pages from teachers, or explanations what a logarithm is ;)

I\'ve got some measurements

相关标签:
3条回答
  • 2020-12-07 02:01

    Also, getting a logarithm with an arbitrary base:

    float logx(float value, float base) 
    {
       return log10f(value) / log10f(base);
    }
    
    0 讨论(0)
  • 2020-12-07 02:06

    How about grabbing a book on C standard library functions?

    Otherwise, you can try man pages: man 3 logf, for example

    0 讨论(0)
  • 2020-12-07 02:14

    math.h is a standard include. the wikipedia page has some documentation.

    Another way to 'squish' the values is to fit your values to a straight line. For you example:

    Straight line equation

    y = mx + c
    y = 'squished' value.
    x = The value you want to squish
    m = Gradient of the line
    c = intercept on the y axis
    

    A quick calculation on your values gives something like:

    y = 1.17e-3 x + 1.96
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题