make mod on floats available in the VM (#9591)
* make `mod` on floats available in the VM * add testcase * removed no longer needed imports
This commit is contained in:
parent
e4e19f8288
commit
da178e4090
2 changed files with 135 additions and 1 deletions
|
|
@ -11,7 +11,7 @@
|
|||
#import vmdeps, vm
|
||||
from math import sqrt, ln, log10, log2, exp, round, arccos, arcsin,
|
||||
arctan, arctan2, cos, cosh, hypot, sinh, sin, tan, tanh, pow, trunc,
|
||||
floor, ceil, fmod
|
||||
floor, ceil, `mod`, fmod
|
||||
|
||||
from os import getEnv, existsEnv, dirExists, fileExists, putEnv, walkDir
|
||||
|
||||
|
|
@ -107,6 +107,10 @@ proc registerAdditionalOps*(c: PCtx) =
|
|||
wrap1f_math(ceil)
|
||||
wrap2f_math(fmod)
|
||||
|
||||
proc `mod Wrapper`(a: VmArgs) {.nimcall.} =
|
||||
setResult(a, `mod`(getFloat(a, 0), getFloat(a, 1)))
|
||||
registerCallback(c, "stdlib.math.mod", `mod Wrapper`)
|
||||
|
||||
when defined(nimcore):
|
||||
wrap2s(getEnv, ospathsop)
|
||||
wrap1s(existsEnv, ospathsop)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue