----common functions and constants of iOS development

Source: Internet
Author: User
Tags pow
<span id="Label3"></p><p><p>Introduce the functions commonly used in objective-c, constant variables</p></p>Arithmetic functions <table border="1"> <caption> "arithmetic function" </caption> <colgroup width="200"></colgroup> <colgroup width="340"></colgroup> <thead> <tr> <th>Name of function</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>int Rand ()</td> <td>Random number Generation.<br>Cases<br>Srand (time (nil)); Initial random number initialization<br>int val = rand () P; Random number between 0~49</td> </tr> <tr> <td>int ABS (int A)</td> <td>Absolute value of an integer<br>(example) int val = ABS (-8);<br>→8<br>* Use fabs when floating-point numbers.</td> </tr> <tr> <td>Double Fabs (double A)</td> <td>Absolute value of floating-point numbers<br>(example) double val = fabs (-12.345);<br>→12.345<br>※the whole number is used Abs.</td> </tr> <tr> <td>Double Floor (double A)</td> <td>Returns the integer portion of a floating-point number (discarding a decimal point)<br>(example) double val = floor (12.345);<br>→12.000</td> </tr> <tr> <td>Double Ceil (double a);</td> <td>Returns the integer portion of a floating-point number (discards the decimal point and enters 1 digits)<br>(example) double val = ceil (12.345);<br>→13.000</td> </tr> <tr> <td>Double POW (double a, double b)</td> <td>A's b-square<br>(example) double val = pow (2, 3);<br>→8</td> </tr> <tr> <td>Double sqrt (double A)</td> <td>Square root of a<br>(example) double val = sqrt (2);<br>→1.41421356</td> </tr> </tbody> </table>Trigonometric function <table border="1"> <caption> Trigonometric functions </caption> <colgroup width="200"></colgroup> <colgroup width="340"></colgroup> <thead> <tr> <th>Name of function</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>Double cos (double a)</td> <td>cosine function (a: Radians)</td> </tr> <tr> <td>Double Sin (double a)</td> <td>sine function (a: Radians)</td> </tr> <tr> <td>Double Tan (double A)</td> <td>Tangent function (a: Radians)</td> </tr> <tr> <td>Double ASIN (double A)</td> <td>Inverse Chord value (a: Radians)</td> </tr> <tr> <td>Double ACOs (double A)</td> <td>Inverse cosine function (a: Radians)</td> </tr> <tr> <td>Double Atan (double A)</td> <td>Inverse tangent function</td> </tr> <tr> <td>Double atan2 (double a, double B)</td> <td>Returns the inverse tangent value of the given a and B coordinate values</td> </tr> </tbody> </table>exponential function <table border="1"> <caption> "exponential function" </caption> <colgroup width="200"></colgroup> <colgroup width="340"></colgroup> <thead> <tr> <th>Name of function</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>Double Log (double A)</td> <td>The value of the pairs based on the base E</td> </tr> <tr> <td>Double log10 (double A)</td> <td>Log function Log</td> </tr> </tbody> </table>Constant<p><p></p></p> <table border="1"> <caption> Constant </caption> <colgroup width="200"></colgroup> <colgroup width="340"></colgroup> <thead> <tr> <th>Constant Number name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>M_pi</td> <td>Pi (=π)</td> </tr> <tr> <td>M_pi_2</td> <td>1/2 of Pi (=π/2)</td> </tr> <tr> <td>M_pi_4</td> <td>1/4 of Pi (=π/4)</td> </tr> <tr> <td>M_1_pi</td> <td>=1/π</td> </tr> <tr> <td>M_2_pi</td> <td>=2/π</td> </tr> <tr> <td>M_e</td> <td>=e</td> </tr> <tr> <td>m_log2e</td> <td>Log_2 (e)</td> </tr> <tr> <td>m_log10e</td> <td>Log_10 (e)</td> </tr> </tbody> </table><p><p>Original Link:----common functions and constants of iOS development</p></p><p><p>----common functions and constants of iOS development</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.