Transferred from: http://blog.sina.com.cn/s/blog_71715bf80101bnvn.html
Arithmetic functions
"Arithmetic function"
Name of function |
Description |
int rand () |
Random number generation. Cases Srand (Time (nil)); Initial random number initialization int val = rand () P; Random number between 0~49 |
int abs (int a) |
Absolute value of an integer (example) int val = ABS (-8); →8 * Use fabs when floating-point numbers. |
Double Fabs (Double A) |
Absolute value of floating-point numbers (example) Double val = fabs (-12.345); →12.345 ※the whole number is used abs. |
Double floor (Double a) |
Returns the integer portion of a floating-point number (discarding a decimal point) (example) Double val = floor (12.345); →12.000 |
Double Ceil (double A); |
Returns the integer portion of a floating-point number (discards the decimal point and enters 1 digits) (example) Double val = ceil (12.345); →13.000 |
Double Pow (double A, double b) |
A's B-square (example) Double val = Pow (2, 3); →8 |
Double sqrt (double A) |
Square root of a (example) Double val = sqrt (2); →1.41421356 |
Trigonometric function
Trigonometric functions
Name of function |
Description |
Double cos (double a) |
Cosine function (A: radians) |
Double sin (double A) |
Sine function (A: radians) |
Double tan (Double A) |
Tangent function (A: radians) |
Double asin (Double A) |
Inverse chord value (a: radians) |
Double ACOs (Double A) |
Inverse cosine function (A: radians) |
Double Atan (Double A) |
Inverse tangent function |
Double atan2 (double A, double b) |
Returns the inverse tangent value of the given a and B coordinate values |
exponential function
"Exponential function"
Name of function |
Description |
Double log (double A) |
The value of the pairs based on the base E |
Double log10 (Double A) |
Log function Log |
Constant
Constant
Constant Number name |
Description |
M_pi |
Pi (=π) |
M_pi_2 |
1/2 of Pi (=Π/2) |
M_pi_4 |
1/4 of Pi (=Π/4) |
M_1_pi |
=1/π |
M_2_pi |
=2/π |
M_e |
=e |
m_log2e |
Log_2 (e) |
m_log10e |
Log_10 (e)
|
Introduce the functions commonly used in objective-c, constant variables