add lost functions (#16843)
This commit is contained in:
parent
f09d97d6d3
commit
296cf9657c
2 changed files with 10 additions and 0 deletions
|
|
@ -105,6 +105,14 @@ func `**`*(x, y: JsBigInt): JsBigInt {.importjs: "((#) $1 #)".} =
|
||||||
# pending https://github.com/nim-lang/Nim/pull/15940, simplify to:
|
# pending https://github.com/nim-lang/Nim/pull/15940, simplify to:
|
||||||
# doAssertRaises: discard big"2" ** big"-1" # raises foreign `RangeError`
|
# doAssertRaises: discard big"2" ** big"-1" # raises foreign `RangeError`
|
||||||
|
|
||||||
|
func `and`*(x, y: JsBigInt): JsBigInt {.importjs: "(# & #)".} =
|
||||||
|
runnableExamples:
|
||||||
|
doAssert (big"555" and big"2") == big"2"
|
||||||
|
|
||||||
|
func `or`*(x, y: JsBigInt): JsBigInt {.importjs: "(# | #)".} =
|
||||||
|
runnableExamples:
|
||||||
|
doAssert (big"555" or big"2") == big"555"
|
||||||
|
|
||||||
func `xor`*(x, y: JsBigInt): JsBigInt {.importjs: "(# ^ #)".} =
|
func `xor`*(x, y: JsBigInt): JsBigInt {.importjs: "(# ^ #)".} =
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
doAssert (big"555" xor big"2") == big"553"
|
doAssert (big"555" xor big"2") == big"553"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ var big3: JsBigInt = big"2"
|
||||||
|
|
||||||
doAssert big3 == big"2"
|
doAssert big3 == big"2"
|
||||||
doAssert (big3 xor big2) == big"664"
|
doAssert (big3 xor big2) == big"664"
|
||||||
|
doAssert (big"555" and big"2") == big"2"
|
||||||
|
doAssert (big"555" or big"2") == big"555"
|
||||||
doAssert (big1 mod big2) == big"613"
|
doAssert (big1 mod big2) == big"613"
|
||||||
doAssert -big1 == big"-2147483647"
|
doAssert -big1 == big"-2147483647"
|
||||||
doAssert big1 div big2 == big"3224449"
|
doAssert big1 div big2 == big"3224449"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue