Lua standard library-mathematical functions)

Source: Internet
Author: User
Tags mathematical functions natural logarithm random seed

This is a standard C arithmetic library. All functions are stored in the Math Table.

1. Math. Abs (X)

Function: returns the absolute value of X.

2. Math. ACOs (X)

Function: returns the arc cosine of X. The value x must be between-1 and 1.

3. Math. asin (X)

Function: returns the arc sine of X. The value x must be between-1 and 1.

4. Math. atan (X)

Function: returns the arc tangent of parameter X.

5. Math. atan2 (x, y)

Function: calculates the arc tangent value of Y/X (applicable when y = 0)

6. Math. Ceil (X)

Function: returns a minimum integer of no less than X. For example, Ceil (6.04) = 7

7. Math. Cos (X)

Function: returns the cosine of X, which is expressed in radians.

8. Math. cosh (X)

Function: returns the hyperbolic cosine of X.

9. Math. DEG (X)

Function: returns the degree of X, which is expressed in radians.

10. Math. exp (X)

Function: returns the X power of E (2.7182818) E.

11. Math. Floor (X)

Function: returns a maximum integer of no more than Arg. For example, floor (6.04) = 6

12. Math. fmod (x, y)

Function: returns the remainder of x/y.

13. Math. frexp (X)

Function: divides the parameter X into two parts and returns the ending number between m 0.5 and 1 (0 when X is 0) and the exponential E. X = m2e

14. Math. Huge

Function: returns a number greater than all values.

15. Math. ldexp (M, E)

Function: opposite to frexp, return the num * (2 ^ exp) parameter ). If overflow occurs, return huge_val.

16. Math. Log (X)

Function: returns the natural logarithm of parameter X. If X is negative, a domain error is generated. If X is zero, a Range Error is generated.

17. Math. log10 (X)

Function: returns the base-10 logarithm of parameter X. If X is negative, a domain error is generated. If X is zero, a Range Error is generated.

18. Math. Max (x ,...)

Function: returns the maximum value of all parameters.

19. Math. Min (x ,...)

Function: returns the minimum value of all parameters.

20. Math. MODF (X)

Function: divides the num parameter into integers and decimals.

21. Math. Pi

Function: The function returns the PI value.

22. Math. Pow (x, y)

Function: returns the yth power based on X. If X is zero or negative and Y is less than or equal to zero or non-integer, a domain error is generated. If overflow occurs, a Range Error occurs.

23. Math. Rad (X)

Function: returns the radians of x. x is the degree.

24. Math. Random ([M [, N])

Function: returns the number between [M, N]. If there is only m, the number of [1, m] is returned.

25. Math. randomseed (X)

Function: sets random seed X.

26. Math. Sin (X)

Function: returns the sine of the ARG parameter, which is expressed in radians.

27. Math. sinh (X)

Function: returns the hyperbolic sine of the ARG parameter.

28. Math. SQRT (X)

Function: returns the square root or 1/2 degrees of X. If num is negative, a domain error is generated.

28. Math. Tan (X)

Function: returns the tangent of the ARG parameter, which is expressed in radians.

28. Math. Tanh (X)

Function: returns the hyperbolic tangent of the ARG parameter.

1

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.