Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigInt runnableExamples: octal, binary, hex constructor #16868

Merged
merged 21 commits into from
Jan 30, 2021
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
bfaf7b6
ReSync with Devel
juancarlospaco Sep 2, 2020
914b642
ReSync devel
juancarlospaco Oct 25, 2020
13064ce
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Oct 26, 2020
76d1123
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Oct 26, 2020
04caa74
ReSync
juancarlospaco Oct 26, 2020
e4d1dce
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Oct 29, 2020
a899cc1
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Nov 3, 2020
d083701
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Nov 20, 2020
f66517f
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Dec 2, 2020
2ec956e
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Jan 15, 2021
8684049
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Jan 16, 2021
2ef8ada
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Jan 18, 2021
c8c07e3
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Jan 21, 2021
1216a03
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Jan 22, 2021
3d391b7
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Jan 22, 2021
3d6a30b
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Jan 24, 2021
f6374a7
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Jan 25, 2021
9977e37
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
juancarlospaco Jan 29, 2021
8f9f19a
https://github.com/nim-lang/Nim/pull/16863/files#r567099096
juancarlospaco Jan 29, 2021
53fbe5e
https://github.com/nim-lang/Nim/pull/16863/files#r567099096
juancarlospaco Jan 29, 2021
e89e9a8
Update lib/std/jsbigints.nim
juancarlospaco Jan 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/std/jsbigints.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ func big*(integer: SomeInteger): JsBigInt {.importjs: "BigInt(#)".} =
## Constructor for `JsBigInt`.
runnableExamples:
doAssert big(1234567890) == big"1234567890"
doAssert 0b1111100111.big == 0o1747.big and 0o1747.big == 999.big

func big*(integer: cstring): JsBigInt {.importjs: "BigInt(#)".} =
## Constructor for `JsBigInt`.
runnableExamples:
doAssert big"-1" == big"1" - big"2"
doAssert big"0xffffffffffffffff" == (1.big shl 64.big) - 1.big
juancarlospaco marked this conversation as resolved.
Show resolved Hide resolved

func toCstring*(this: JsBigInt; radix: 2..36): cstring {.importjs: "#.toString(#)".} =
## Converts from `JsBigInt` to `cstring` representation.
Expand Down Expand Up @@ -210,6 +212,3 @@ runnableExamples:
var b: JsBigInt
doAssert b == big"0"
doAssert b == JsBigInt.default
block `octal binary hexadecimal`:
doAssert big"0xffffffffffffffff" == (1.big shl 64.big) - 1.big
doAssert 0b1111100111.big == 0o1747.big and 0o1747.big == 999.big