执行“准备好”的Objective-C中的数学运算 [英] Execute a "prepared" math operation in Objective-C
问题描述
我想用某种准备好的公式进行数学运算,看起来像 tan(%f)* 1000
或%f +%f
其中%f必须被参数替换。
I want to to math operations with some kind of prepared formula that would look like tan(%f)*1000
or %f+%f
where the %f has to be replaced by an argument.
Objective-C中是否有一个函数可以传递我的格式公式和执行此准备操作所需的数字?
Is there a function in Objective-C that I can pass the format of my formula and the required numbers to execute this prepared operation?
我希望问题描述可以理解,如果没有,请发表评论。
I hope the problem is described understandable, if not, leave a comment.
提前致谢。
编辑1:感谢您的答案到目前为止,但我正在寻找更多的东西动态。块和内联函数很棒,但是静态。我也明白这可能很难实现开箱即用。
Edit 1: Thanks for your answers so far, but I'm looking for something more dynamic. The block and inline function is great, but to static. I also understand that this may be something hard to achieve out of the box.
推荐答案
您可能对DDMathParser感兴趣,在这里找到。我相信它会做你想要的一切。
You may be interested in DDMathParser, found here. I believe it will do everything you're looking for.
这篇关于执行“准备好”的Objective-C中的数学运算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!