Try to fix #25

This commit is contained in:
Rerumu 2022-12-07 02:42:29 -05:00
parent e1e8a4ddc1
commit 2f8eadad6c

View File

@ -40,6 +40,7 @@ do
local math_abs = math.abs local math_abs = math.abs
local math_fmod = math.fmod local math_fmod = math.fmod
local math_modf = math.modf
local math_round = math.round local math_round = math.round
local math_sign = math.sign local math_sign = math.sign
local math_min = math.min local math_min = math.min
@ -81,13 +82,13 @@ do
lhs = to_i32(lhs) lhs = to_i32(lhs)
rhs = to_i32(rhs) rhs = to_i32(rhs)
return to_u32(lhs / rhs) return to_u32((math_modf(lhs / rhs)))
end end
function div.u32(lhs, rhs) function div.u32(lhs, rhs)
assert(rhs ~= 0, "division by zero") assert(rhs ~= 0, "division by zero")
return to_u32(lhs / rhs) return to_u32((math_modf(lhs / rhs)))
end end
function rem.i32(lhs, rhs) function rem.i32(lhs, rhs)