not change
constant 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) |
arithmetic Functions
Name of function |
Description |
int rand () |
Random number generation. Cases Srand (Time (nil)); Initial random number initialization int val = rand ()%50; 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 |
Objective-c arithmetic functions and constants represent