* fix js unsigned integer * Use `std` prefix for standard library modules * fix #17118
This commit is contained in:
parent
cde950e1bc
commit
32bf10126c
2 changed files with 30 additions and 19 deletions
|
|
@ -11,7 +11,8 @@
|
||||||
#import vmdeps, vm
|
#import vmdeps, vm
|
||||||
from std/math import sqrt, ln, log10, log2, exp, round, arccos, arcsin,
|
from std/math import sqrt, ln, log10, log2, exp, round, arccos, arcsin,
|
||||||
arctan, arctan2, cos, cosh, hypot, sinh, sin, tan, tanh, pow, trunc,
|
arctan, arctan2, cos, cosh, hypot, sinh, sin, tan, tanh, pow, trunc,
|
||||||
floor, ceil, `mod`
|
floor, ceil, `mod`, cbrt, arcsinh, arccosh, arctanh, erf, erfc, gamma,
|
||||||
|
lgamma
|
||||||
|
|
||||||
when declared(math.copySign):
|
when declared(math.copySign):
|
||||||
from std/math import copySign
|
from std/math import copySign
|
||||||
|
|
@ -159,6 +160,7 @@ proc registerAdditionalOps*(c: PCtx) =
|
||||||
setResult a, c.config.projectPath.string
|
setResult a, c.config.projectPath.string
|
||||||
|
|
||||||
wrap1f_math(sqrt)
|
wrap1f_math(sqrt)
|
||||||
|
wrap1f_math(cbrt)
|
||||||
wrap1f_math(ln)
|
wrap1f_math(ln)
|
||||||
wrap1f_math(log10)
|
wrap1f_math(log10)
|
||||||
wrap1f_math(log2)
|
wrap1f_math(log2)
|
||||||
|
|
@ -166,6 +168,9 @@ proc registerAdditionalOps*(c: PCtx) =
|
||||||
wrap1f_math(arccos)
|
wrap1f_math(arccos)
|
||||||
wrap1f_math(arcsin)
|
wrap1f_math(arcsin)
|
||||||
wrap1f_math(arctan)
|
wrap1f_math(arctan)
|
||||||
|
wrap1f_math(arcsinh)
|
||||||
|
wrap1f_math(arccosh)
|
||||||
|
wrap1f_math(arctanh)
|
||||||
wrap2f_math(arctan2)
|
wrap2f_math(arctan2)
|
||||||
wrap1f_math(cos)
|
wrap1f_math(cos)
|
||||||
wrap1f_math(cosh)
|
wrap1f_math(cosh)
|
||||||
|
|
@ -178,6 +183,10 @@ proc registerAdditionalOps*(c: PCtx) =
|
||||||
wrap1f_math(trunc)
|
wrap1f_math(trunc)
|
||||||
wrap1f_math(floor)
|
wrap1f_math(floor)
|
||||||
wrap1f_math(ceil)
|
wrap1f_math(ceil)
|
||||||
|
wrap1f_math(erf)
|
||||||
|
wrap1f_math(erfc)
|
||||||
|
wrap1f_math(gamma)
|
||||||
|
wrap1f_math(lgamma)
|
||||||
|
|
||||||
when declared(copySign):
|
when declared(copySign):
|
||||||
wrap2f_math(copySign)
|
wrap2f_math(copySign)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import std/math
|
||||||
# Function for approximate comparison of floats
|
# Function for approximate comparison of floats
|
||||||
proc `==~`(x, y: float): bool = abs(x - y) < 1e-9
|
proc `==~`(x, y: float): bool = abs(x - y) < 1e-9
|
||||||
|
|
||||||
|
|
||||||
|
template main() =
|
||||||
block:
|
block:
|
||||||
when not defined(js):
|
when not defined(js):
|
||||||
# check for no side effect annotation
|
# check for no side effect annotation
|
||||||
|
|
@ -30,7 +32,7 @@ block:
|
||||||
when not defined(js) and not defined(windows): # xxx pending bug #17017
|
when not defined(js) and not defined(windows): # xxx pending bug #17017
|
||||||
doAssert gamma(-1.0).isNaN
|
doAssert gamma(-1.0).isNaN
|
||||||
|
|
||||||
template main() =
|
|
||||||
block: # sgn() tests
|
block: # sgn() tests
|
||||||
doAssert sgn(1'i8) == 1
|
doAssert sgn(1'i8) == 1
|
||||||
doAssert sgn(1'i16) == 1
|
doAssert sgn(1'i16) == 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue