Objective-C/cocoa-touch 中有哪些对数函数/方法?
我尝试过搜索对数+ Objective-C,但我得到的只是老师提供的数学测试页,或者解释什么是对数;)
我得到了一些类似于 83912.41234 的测量结果,其他的是 32.94232。 我需要将这个巨大的频谱压缩到 0 到 100 之间,并且 32.94232 必须至少大于 2,其中 83912.41234 将接近 100。所以我认为对数函数将是我的朋友。
更新: 我通过“快速打开”(Xcode 中非常好的命令:SHIFT + CMD + D)遇到了 math.h 文件,然后,大吃一惊:
extern double log ( double );
extern float logf ( float );
extern double log10 ( double );
extern float log10f ( float );
extern double log2 ( double );
extern float log2f ( float );
extern double log1p ( double );
extern float log1pf ( float );
extern double logb ( double );
extern float logbf ( float );
但是:没有文字,没有注释。 我不是一个数学狂。 因此,一些描述会很好,例如,什么情况下需要什么样的对数,曲线是什么样子等等......所以任何好的链接都将受到高度赞赏!
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 that are like 83912.41234 and others are 32.94232. I need to press down this huge spectrum into something between 0 and 100, and that 32.94232 would habe to be at least something bigger than 2, where the 83912.41234 would be something near 100. So I think a logarithm function will be my friend here.
UPDATE:
I've came across the math.h file through "Open Quickly" (very nice command in Xcode: SHIFT + CMD + D), and there, big surprise:
extern double log ( double );
extern float logf ( float );
extern double log10 ( double );
extern float log10f ( float );
extern double log2 ( double );
extern float log2f ( float );
extern double log1p ( double );
extern float log1pf ( float );
extern double logb ( double );
extern float logbf ( float );
But: No text, no comments. I'm not such a math-freak. So some description would be good, i.e. what kind of logarithm for what case, how the curve looks like, etc... so any great links are highly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
另外,获取任意底数的对数:
Also, getting a logarithm with an arbitrary base:
math.h 是一个标准包含。 wikipedia 页面有一些文档。
“压缩”值的另一种方法是将值拟合成一条直线。 对于您的示例:
直线方程
对您的值的快速计算给出如下内容:
希望这有帮助。
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
A quick calculation on your values gives something like:
Hope this helps.
买一本关于 C 标准库函数的书怎么样?
否则,您可以尝试手册页:
例如,
man 3 logf
How about grabbing a book on C standard library functions?
Otherwise, you can try man pages:
man 3 logf
, for example