math.asin

Returns the arcsine (inverse sine) of num (in radians). This is equivalent to . To convert the output to degrees, you can use math.deg (for example: math.deg(math.asin(0.5))).

Namearcsine
Lua functionmath.asin
Usual notation
Definition
Domain of x for real result
Range of usual principal value
(radians)
ExamplePrint the arcsine of user input
Read a line from the user, print its arcsine in radians, then in degrees.
Code
<nowiki>
local num = math.asin(tonumber(read()))
print(num)
print(math.deg(num))
    </nowiki>
Output Depends on what the user wrote. For instance, if they were to enter 0.5, the numbers printed would be 0.523598776 () and 30.

math.asin
Function
Syntax
math.asin(
  • num : number
)

Returns number
API math
Source Lua (source)
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.