summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luaotfload/fontloader-l-math.lua
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/luaotfload/fontloader-l-math.lua')
-rw-r--r--macros/luatex/generic/luaotfload/fontloader-l-math.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/macros/luatex/generic/luaotfload/fontloader-l-math.lua b/macros/luatex/generic/luaotfload/fontloader-l-math.lua
index 69f0a19e98..6105bc3c2d 100644
--- a/macros/luatex/generic/luaotfload/fontloader-l-math.lua
+++ b/macros/luatex/generic/luaotfload/fontloader-l-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