From a2c780029041b2eb3abfbe04ba51d442461335bf Mon Sep 17 00:00:00 2001 From: Max Cahill <1bardesign@gmail.com> Date: Tue, 29 Jun 2021 14:44:09 +1000 Subject: [PATCH] Note about branchless or abs-based mathx.sign --- mathx.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mathx.lua b/mathx.lua index f109e94..082c99e 100644 --- a/mathx.lua +++ b/mathx.lua @@ -46,6 +46,7 @@ function mathx.to_precision(v, decimal_points) end --0, 1, -1 sign of a scalar +--todo: investigate if a branchless or `/abs` approach is faster in general case function mathx.sign(v) if v < 0 then return -1 end if v > 0 then return 1 end