* fix #16815 round+places works again in vm * improve tests; fix for linux 32bit * fix test for windows
This commit is contained in:
parent
37a98c6c58
commit
b0f38a63c4
3 changed files with 41 additions and 29 deletions
|
|
@ -52,6 +52,7 @@ template md5op(op) {.dirty.} =
|
|||
|
||||
template wrap1f_math(op) {.dirty.} =
|
||||
proc `op Wrapper`(a: VmArgs) {.nimcall.} =
|
||||
doAssert a.numArgs == 1
|
||||
setResult(a, op(getFloat(a, 0)))
|
||||
mathop op
|
||||
|
||||
|
|
@ -157,7 +158,6 @@ proc registerAdditionalOps*(c: PCtx) =
|
|||
wrap1f_math(log10)
|
||||
wrap1f_math(log2)
|
||||
wrap1f_math(exp)
|
||||
wrap1f_math(round)
|
||||
wrap1f_math(arccos)
|
||||
wrap1f_math(arcsin)
|
||||
wrap1f_math(arctan)
|
||||
|
|
@ -180,6 +180,13 @@ proc registerAdditionalOps*(c: PCtx) =
|
|||
when declared(signbit):
|
||||
wrap1f_math(signbit)
|
||||
|
||||
registerCallback c, "stdlib.math.round", proc (a: VmArgs) {.nimcall.} =
|
||||
let n = a.numArgs
|
||||
case n
|
||||
of 1: setResult(a, round(getFloat(a, 0)))
|
||||
of 2: setResult(a, round(getFloat(a, 0), getInt(a, 1).int))
|
||||
else: doAssert false, $n
|
||||
|
||||
wrap1s(getMD5, md5op)
|
||||
|
||||
proc `mod Wrapper`(a: VmArgs) {.nimcall.} =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue