20 lines
839 B
Text
20 lines
839 B
Text
local fmt = require "fmt"
|
|
|
|
local d = 30
|
|
local r = d * math.pi / 180
|
|
local s = 0.5
|
|
local c = math.sqrt(3) / 2
|
|
local t = 1 / math.sqrt(3)
|
|
|
|
fmt.print("sin(%9.6f deg) = %f", d, math.sin(d * math.pi / 180))
|
|
fmt.print("sin(%9.6f rad) = %f", r, math.sin(r))
|
|
fmt.print("cos(%9.6f deg) = %f", d, math.cos(d * math.pi / 180))
|
|
fmt.print("cos(%9.6f rad) = %f", r, math.cos(r))
|
|
fmt.print("tan(%9.6f deg) = %f", d, math.tan(d * math.pi / 180))
|
|
fmt.print("tan(%9.6f rad) = %f", r, math.tan(r))
|
|
fmt.print("asin(%f) = %9.6f deg", s, math.asin(s) * 180 / math.pi)
|
|
fmt.print("asin(%f) = %9.6f rad", s, math.asin(s))
|
|
fmt.print("acos(%f) = %9.6f deg", c, math.acos(c) * 180 / math.pi)
|
|
fmt.print("acos(%f) = %9.6f rad", c, math.acos(c))
|
|
fmt.print("atan(%f) = %9.6f deg", t, math.atan(t) * 180 / math.pi)
|
|
fmt.print("atan(%f) = %9.6f rad", t, math.atan(t))
|