|
Oktatás * Programozás 1 * Szkriptnyelvek Teaching * Programming 1 (BI) Félévek Linkek * kalendárium |
Nim2 /
bigintsbigints is a 3rd-party library for working with arbitrary precision integers. $ nimble install bigints Links:
There's also a func pow(x: BigInt, y: Natural): BigInt The import bigints let a: BigInt = initBigInt(0) # 0 as BigInt b = initBigInt(2) # 2 as BigInt c = 5.initBigInt # 5 as BigInt (alternative syntax) d = "645347534".initBigInt # create a BigInt from a string ExampleHow much is 2256? import bigints let result = pow(2.initBigInt, 256) echo result let s: string = $result echo s Output: 115792089237316195423570985008687907853269984665640564039457584007913129639936 115792089237316195423570985008687907853269984665640564039457584007913129639936 As you can see, a BigInt can be converted to a string with the Notes
|
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |