English 中文(简体)
Math Library in PicSDK?
原标题:Math library in iPhone SDK?

I m 试图计算一个小型电话的这个公式:

x = 120 x num^-1.123 x tr^-0.206 x [te] x [fe]

x 相当于120倍升至0.123倍,升至0.206倍。

用户输入的已知数字是南、tr、茶和牛。

How do I do that? I m stuck in the negative decimal power of num and tr.

得到的任何帮助

最佳回答

Foundation will include math functions, so all you have to do is use one of the pow() functions to work with. Use pow() for working with doubles, powf() for floats, or powl() for long doubles. Here s an example:

double num = 2.0;
double tr = 3.0;
double te = 4.0;
double fe = 5.0;

double x = 120.0 * pow(num, -1.123) * pow(tr, -0.206) * te * fe;
问题回答

The iPhone SDK contains the standard C library functions (math.h) that you could use for these kind of math. Searching for math.h in your XCode documentation should show all the related functions (like pow for raising x to the power of y).





相关问题
Maths in LaTex table of contents

I am trying to add a table of contents for my LaTex document. The issue I am having is that this line: subsubsection{The expectation of (X^2)} Causes an error in the file that contains the ...

Math Overflow -- Handling Large Numbers

I am having a problem handling large numbers. I need to calculate the log of a very large number. The number is the product of a series of numbers. For example: log(2x3x66x435x444) though my actual ...

Radial plotting algorithm

I have to write an algorithm in AS3.0 that plots the location of points radially. I d like to input a radius and an angle at which the point should be placed. Obviously I remember from geometry ...

Subsequent weighted algorithm for comparison

I have two rows of numbers ... 1) 2 2 1 0 0 1 2) 1.5 1 0 .5 1 2 Each column is compared to each other. Lower values are better. For example Column 1, row 2 s value (1.5) is more ...

热门标签