Math API
Functions
|
|||||||||||
Return the absolute value of num (i.e. the number's distance from zero). This means that negative numbers will be converted to a positive number (e.g. -5 into 5), and positive numbers remain unaffected. The return value will always be a positive number. | |||||||||||
Syntax | math.abs(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Return num rounded to the next whole integer. | |||||||||||
Syntax | math.ceil(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Return the cosine of num.
|
|||||||||||
Syntax | math.cos(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Convert the number num from radians to degrees. | |||||||||||
Syntax | math.deg(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Returns e raised to the power of num. | |||||||||||
Syntax | math.exp(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Return num rounded to the previous whole integer. | |||||||||||
Syntax | math.floor(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Return the remainder of dividing x by y. This has the same behaviour as the % operator. |
|||||||||||
Syntax | math.mod(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Return the mantissa and exponent of num, two numbers and such that | |||||||||||
Syntax | math.frexp(
|
||||||||||
Returns | number mantissa, number exponent | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Compute a floating point number from the given mantissa and exponent. This is the inverse operation of math.frexp, and computes . | |||||||||||
Syntax | math.ldexp(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Return the greatest of all the numbers given. | |||||||||||
Syntax | math.max(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Return the smallest of all the numbers given. | |||||||||||
Syntax | math.min(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Return the integer and fractional parts of number. | |||||||||||
Syntax | math.modf(
|
||||||||||
Returns | number integral, number fractional | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Return x raised to the yth power. This is equivalent to the operator ^ . |
|||||||||||
Syntax | math.pow(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Convert the number num from degrees to radians. | |||||||||||
Syntax | math.rad(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Sets the seed for the random number generator used by math.random. The same seeds produce will always produce the same random numbers. | |||||||||||
Syntax | math.randomseed(
|
||||||||||
Returns | nil | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Returns the sine of num.
|
|||||||||||
Syntax | math.sin(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Returns the square root of num. | |||||||||||
Syntax | math.sqrt(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
|
|||||||||||
Returns the tangent of num.
|
|||||||||||
Syntax | math.tan(
|
||||||||||
Returns | number | ||||||||||
Part of | Lua (source) | ||||||||||
API | math | ||||||||||
|
Constants
|
|||
Floating point positive infinity, a number greater than any other. | |||
Type | number | ||
Value | inf
|
||
Part of | CC:Tweaked |
|
|||
An approximation of the mathematical constant π. | |||
Type | number | ||
Value | 3.1415926535898
|
||
Part of | CC:Tweaked |
gollark: We may have to bring the EWO page in line with reality eventually.
gollark: No.
gollark: <@!332271551481118732> The wiki now contains Emu War games you haven't even written yet! https://tty0.xyz/emuwar/doku.php?id=games:online:start
gollark: For ntpd text processor.
gollark: Call it... NTP Text Processor, instead.
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.