summaryrefslogtreecommitdiff
path: root/tex/context/base/l-math.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/l-math.lua')
-rw-r--r--tex/context/base/l-math.lua30
1 files changed, 22 insertions, 8 deletions
diff --git a/tex/context/base/l-math.lua b/tex/context/base/l-math.lua
index 00b72dba5..bfb3d506b 100644
--- a/tex/context/base/l-math.lua
+++ b/tex/context/base/l-math.lua
@@ -1,12 +1,12 @@
--- filename : l-math.lua
--- comment : split off from luat-lib
--- author : Hans Hagen, PRAGMA-ADE, Hasselt NL
--- copyright: PRAGMA ADE / ConTeXt Development Team
--- license : see context related readme files
+if not modules then modules = { } end modules ['l-math'] = {
+ version = 1.001,
+ comment = "companion to luat-lib.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
-if not versions then versions = { } end versions['l-math'] = 1.001
-
-local floor = math.floor
+local floor, sin, cos, tan = math.floor, math.sin, math.cos, math.tan
if not math.round then
function math.round(x)
@@ -25,3 +25,17 @@ if not math.mod then
return n % m
end
end
+
+local pipi = 2*math.pi/360
+
+function math.sind(d)
+ return sin(d*pipi)
+end
+
+function math.cosd(d)
+ return cos(d*pipi)
+end
+
+function math.tand(d)
+ return tan(d*pipi)
+end