summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/lualibs/lualibs-math.lua
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/lualibs/lualibs-math.lua')
-rw-r--r--macros/luatex/generic/lualibs/lualibs-math.lua16
1 files changed, 13 insertions, 3 deletions
diff --git a/macros/luatex/generic/lualibs/lualibs-math.lua b/macros/luatex/generic/lualibs/lualibs-math.lua
index e5668a5db0..6105bc3c2d 100644
--- a/macros/luatex/generic/lualibs/lualibs-math.lua
+++ b/macros/luatex/generic/lualibs/lualibs-math.lua
@@ -14,9 +14,19 @@ end
if not math.round then
- local floor = math.floor
+ if xmath then
+
+ math.round = xmath.round
+
+ else
- function math.round(x) return floor(x + 0.5) end
+ local floor = math.floor
+
+ function math.round(x)
+ return x < 0 and -floor(-x + 0.5) or floor(x + 0.5)
+ end
+
+ end
end
@@ -141,7 +151,7 @@ if not math.ult then
local floor = math.floor
- function math.tointeger(m,n)
+ function math.ult(m,n)
-- not ok but i'm not motivated to look into it now
return floor(m) < floor(n) -- unsigned comparison needed
end