7po3j-syaaa-aaaal-qbqea-cai.icp0.io
Open in
urlscan Pro
212.71.124.188
Public Scan
URL:
https://7po3j-syaaa-aaaal-qbqea-cai.icp0.io/base-library/primitive-types/bounded-number-types/int64.html
Submission: On January 11 via api from US — Scanned from GB
Submission: On January 11 via api from US — Scanned from GB
Form analysis
1 forms found in the DOM<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
Text Content
1. The Motoko Programming Language 2. 3. Part 1 4. 1. Introduction ❱ 5. 1. 1.1. Getting Started 6. 2. Common Programming Concepts ❱ 7. 1. 2.1. Variables 2. 2.2. Mutability 3. 2.3. Comments 4. 2.4. Types ❱ 5. 1. 2.4.1. Tuples 2. 2.4.2. Records 3. 2.4.3. Variants 4. 2.4.4. Immutable Arrays 5. 2.4.5. Mutable Arrays 6. 2.5. Operators ❱ 7. 1. 2.5.1. Numeric operators 2. 2.5.2. Relational operators 3. 2.5.3. Assignment operators 4. 2.5.4. Text concatenation 5. 2.5.5. Logical expressions 6. 2.5.6. Bitwise operators 7. 2.5.7. Operator precedence 8. 2.6. Pattern Matching 9. 2.7. Functions 10. 2.8. Options and Results 11. 2.9. Control Flow ❱ 12. 1. 2.9.1. If Expression 2. 2.9.2. If Else Expression 3. 2.9.3. Switch Expression 13. 2.10. Objects and Classes ❱ 14. 1. 2.10.1. Objects 2. 2.10.2. Classes 15. 2.11. Modules and Imports 16. 2.12. Assertions 8. 3. Internet Computer Programming Concepts ❱ 9. 1. 3.1. Actors ❱ 2. 1. 3.1.1. From Actor to Canister 2. 3.1.2. Canister Calls from Clients 3. 3.2. Principals and Authentication 4. 3.3. Async Data ❱ 5. 1. 3.3.1. Shared Types 2. 3.3.2. Candid 6. 3.4. Basic Memory Persistence ❱ 7. 1. 3.4.1. Upgrades 2. 3.4.2. Stable Variables 10. 11. Part 2 12. 4. Advanced Types ❱ 13. 1. 4.1. Generic Types 2. 4.2. Subtyping 3. 4.3. Recursive Types 4. 4.4. Type Bounds 14. 5. The Base Library ❱ 15. 1. 5.1. Primitive Types ❱ 2. 1. 5.1.1. Bool 2. 5.1.2. Nat 3. 5.1.3. Int 4. 5.1.4. Float 5. 5.1.5. Principal 6. 5.1.6. Text 7. 5.1.7. Char 8. 5.1.8. Bounded Number Types ❱ 9. 1. 5.1.8.1. Nat8 2. 5.1.8.2. Nat16 3. 5.1.8.3. Nat32 4. 5.1.8.4. Nat64 5. 5.1.8.5. Int8 6. 5.1.8.6. Int16 7. 5.1.8.7. Int32 8. 5.1.8.8. Int64 10. 5.1.9. Blob 3. 5.2. Utility Modules ❱ 4. 1. 5.2.1. Iterators 2. 5.2.2. Hash 3. 5.2.3. Option 4. 5.2.4. Result 5. 5.2.5. Order 6. 5.2.6. Error 7. 5.2.7. Debug 5. 5.3. Data Structures ❱ 6. 1. 5.3.1. Array 2. 5.3.2. List 3. 5.3.3. Buffer 4. 5.3.4. HashMap 5. 5.3.5. RBTree 7. 5.4. More Data Structures 8. 5.5. IC APIs ❱ 9. 1. 5.5.1. Time 2. 5.5.2. Timer 3. 5.5.3. CertifiedData 4. 5.5.4. Random 5. 5.5.5. Experimental 16. 6. Advanced Concepts ❱ 17. 1. 6.1. Async Programming 2. 6.2. Scalability ❱ 3. 1. 6.2.1. Actor Classes 2. 6.2.2. Stable Storage 4. 6.3. System API's ❱ 5. 1. 6.3.1. Message Inspection 2. 6.3.2. Timers 3. 6.3.3. Certified Variables 4. 6.3.4. Pre-upgrade and Post-upgrade 5. 6.3.5. Cryptographic Randomness 18. 19. Part 3 20. 7. Project Deployment ❱ 21. 1. 7.1. Installing the SDK 2. 7.2. Local Deployment 3. 7.3. Canister Status 4. 7.4. Identities and PEM Files 5. 7.5. Cycles and ICP 6. 7.6. Cycles Wallet 7. 7.7. IC Deployment 22. 8. Common Internet Computer Canisters ❱ 23. 1. 8.1. IC Management Canister 2. 8.2. ICP Ledger Canister 3. 8.3. Cycle Minting Canister 24. 9. Internet Computer Standards ❱ 25. 1. 9.1. ICRC1 26. 10. Tokenized Comments Example 27. 28. APPENDIX 29. 11. TABLES * Light * Rust * Coal * Navy * Ayu THE MOTOKO PROGRAMMING LANGUAGE BOOK INT64 The convention is to name the module alias after the file name it is defined in: import Int64 "mo:base/Int64"; ON THIS PAGE CONSTANTS Value minimumValue Value maximumValue CONVERSION Function toInt Function toText Function fromInt Function fromIntWrap Function fromNat64 Function toNat64 COMPARISON Function min Function max Function equal Function notEqual Function less Function lessOrEqual Function greater Function greaterOrEqual Function compare NUMERICAL OPERATIONS Function abs Function neg Function add Function sub Function mul Function div Function rem Function pow BITWISE OPERATORS Function bitnot Function bitand Function bitor Function bitxor Function bitshiftLeft Function bitshiftRight Function bitrotLeft Function bitrotRight Function bittest Function bitset Function bitclear Function bitflip Function bitcountNonZero Function bitcountLeadingZero Function bitcountTrailingZero WRAPPING OPERATIONS Function addWrap Function subWrap Function mulWrap Function powWrap MINIMUMVALUE let minimumValue : Int64 = -9_223_372_036_854_775_808; MAXIMUMVALUE let maximumValue : Int64 = 9_223_372_036_854_775_807; INT64.TOINT func toInt(i : Int64) : Int The function toInt takes one Int64 value and returns an Int value. import Int64 "mo:base/Int64"; let a : Int64 = -92233; Int64.toInt(a); INT64.TOTEXT func toText(i : Int64) : Text The function toText takes one Int64 value and returns a Text value. import Int64 "mo:base/Int64"; let b : Int64 = -92233; Int64.toText(b); INT64.FROMINT func fromInt(i : Int) : Int64 The function fromInt takes one Int value and returns an Int64 value. import Int64 "mo:base/Int64"; let integer : Int = -92233; Int64.fromInt(integer); INT64.FROMINTWRAP func fromIntWrap(i : Int) : Int64 The function fromIntWrap takes one Int value and returns an Int64 value. import Int64 "mo:base/Int64"; let integer : Int = 18_446_744_073_709_551_615; Int64.fromIntWrap(integer); INT64.FROMNAT64 func fromNat64(i : Nat64) : Int64 The function fromNat64 takes one Nat64 value and returns an Int64 value. import Int64 "mo:base/Int64"; let nat64 : Nat64 = 18_446_744_073_709_551_615; Int64.fromNat64(nat64); INT64.TONAT64 func toNat64(i : Int64) : Nat64 The function toNat64 takes one Int64 value and returns an Nat64 value. import Int64 "mo:base/Int64"; let int64 : Int64 = -9551616; Int64.toNat64(int64); INT64.MIN func min(x : Int64, y : Int64) : Int64 The function min takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 2000; let y : Int64 = 1001; Int64.min(x, y); INT64.MAX func max(x : Int64, y : Int64) : Int64 The function max takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 2000; let y : Int64 = 2001; Int64.max(x, y); INT64.EQUAL func equal(x : Int64, y : Int64) : Bool The function equal takes two Int64 value and returns a Bool value. import Int64 "mo:base/Int64"; let x : Int64 = 1000; let y : Int64 = 100; Int64.equal(x, y); INT64.NOTEQUAL func notEqual(x : Int64, y : Int64) : Bool The function notEqual takes two Int64 value and returns a Bool value. import Int64 "mo:base/Int64"; let x : Int64 = 1000; let y : Int64 = 1001; Int64.notEqual(x, y); INT64.LESS func less(x : Int64, y : Int64) : Bool The function less takes two Int64 value and returns a Bool value. import Int64 "mo:base/Int64"; let x : Int64 = 2000; let y : Int64 = 2500; Int64.less(x, y); INT64.LESSOREQUAL func lessOrEqual(x : Int64, y : Int64) : Bool The function lessOrEqual takes two Int64 value and returns a Bool value. import Int64 "mo:base/Int64"; let x : Int64 = 2000; let y : Int64 = 2500; Int64.lessOrEqual(x, y); INT64.GREATER func greater(x : Int64, y : Int64) : Bool The function greater takes two Int64 value and returns a Bool value. import Int64 "mo:base/Int64"; let x : Int64 = 2000; let y : Int64 = 1000; Int64.greater(x, y); INT64.GREATEROREQUAL func greaterOrEqual(x : Int64, y : Int64) : Bool The function greaterOrEqual takes two Int64 value and returns a Bool value. import Int64 "mo:base/Int64"; let x : Int64 = 2000; let y : Int64 = 1000; Int64.greaterOrEqual(x, y); INT64.COMPARE func compare(x : Int64, y : Int64) : Bool The function compare takes two Int64 value and returns an Order variant value. import Int64 "mo:base/Int64"; let x : Int64 = 10000; let y : Int64 = 9999; Int64.compare(x, y); INT64.ABS func abs(x : Int64) : Int64 The function abs takes one Int64 value and returns a Int64 value. import Int8 "mo:base/Int8"; let x : Int8 = -40; Int8.abs(x); INT64.NEG func neg(x : Int64) : Int64 The function neg takes one Int64 value and returns a Int64 value. import Int8 "mo:base/Int8"; let x : Int8 = -50; Int8.neg(x); INT64.ADD func add(x : Int64, y : Int64) : Int64 The function add takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 2000; let y : Int64 = 1200; Int64.add(x, y); INT64.SUB func sub(x : Int64, y : Int64) : Int64 The function sub takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 4000; let y : Int64 = 3999; Int64.sub(x, y); INT64.MUL func mul(x : Int64, y : Int64) : Int64 The function mul takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 200; let y : Int64 = 50; Int64.mul(x, y); INT64.DIV func div(x : Int64, y : Int64) : Int64 The function div takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 5000; let y : Int64 = 500; Int64.div(x, y); INT64.REM func rem(x : Int64, y : Int64) : Int64 The function rem takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 4000; let y : Int64 = 1200; Int64.rem(x, y); INT64.POW func pow(x : Int64, y : Int64) : Int64 The function pow takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 10; let y : Int64 = 5; Int64.pow(x, y); INT64.BITNOT func bitnot(x : Int64) : Int64 The function bitnot takes one Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 9_223_372_036_854_775_807; Int64.bitnot(x) INT64.BITAND func bitand(x : Int64, y : Int64) : Int64 The function bitand takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 4294967295; let y : Int64 = 255; Int64.bitand(x, y) INT64.BITOR func bitor(x : Int64, y : Int64) : Int64 The function bitor takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 240; let y : Int64 = 15; Int64.bitor(x, y) INT64.BITXOR func bitxor(x : Int64, y : Int64) : Int64 The function bitxor takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 255; let y : Int64 = 240; Int64.bitxor(x, y) INT64.BITSHIFTLEFT func bitshiftLeft(x : Int64, y : Int64) : Int64 The function bitshiftLeft takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 15; let y : Int64 = 4; Int64.bitshiftLeft(x, y) INT64.BITSHIFTRIGHT func bitshiftRight(x : Int64, y : Int64) : Int64 The function bitshiftRight takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 240; let y : Int64 = 4; Int64.bitshiftRight(x, y) INT64.BITROTLEFT func bitrotLeft(x : Int64, y : Int64) : Int64 The function bitrotLeft takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 9_223_372_036_854_775_807; let y : Int64 = 1; Int64.bitrotLeft(x, y) INT64.BITROTRIGHT func bitrotRight(x : Int64, y : Int64) : Int64 The function bitrotRight takes two Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 9_223_372_036_854_775_807; let y : Int64 = 1; Int64.bitrotRight(x, y) INT64.BITTEST func bittest(x : Int64, p : Nat) : Bool The function bittest takes one Int64 and one Nat value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 255; let p : Nat = 7; Int64.bittest(x, p) INT64.BITSET func bitset(x : Int64, p : Nat) : Bool The function bitset takes one Int64 and one Nat value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 127; let p : Nat = 7; Int64.bitset(x, p) INT64.BITCLEAR func bitclear(x : Int64, p : Nat) : Bool The function bitclear takes one Int64 and one Nat value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 255; let p : Nat = 7; Int64.bitclear(x, p) INT64.BITFLIP func bitflip(x : Int64, p : Nat) : Bool The function bitflip takes one Int64 and one Nat value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 255; let p : Nat = 7; Int64.bitflip(x, p) INT64.BITCOUNTNONZERO let bitcountNonZero : (x : Int64) -> Int64 The function bitcountNonZero takes one Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 255; Int64.bitcountNonZero(x) INT64.BITCOUNTLEADINGZERO let bitcountLeadingZero : (x : Int64) -> Int64 The function bitcountLeadingZero takes one Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 255; Int64.bitcountLeadingZero(x) INT64.BITCOUNTTRAILINGZERO let bitcountTrailingZero : (x : Int64) -> Int64 The function bitcountTrailingZero takes one Int64 value and returns a Int64 value. import Int64 "mo:base/Int64"; let x : Int64 = 128; Int64.bitcountTrailingZero(x) INT64.ADDWRAP func addWrap(x : Int64, y : Int64) : Int64 The function addWrap takes two Int64 value and returns a Int64 value.It is equivalent to the +% Bitwise operators. import Int64 "mo:base/Int64"; let x : Int64 = 9_223_372_036_854_775_807; let y : Int64 = 1; Int64.addWrap(x, y) INT64.SUBWRAP func subWrap(x : Int64, y : Int64) : Int64 The function subWrap takes two Int64 value and returns a Int64 value.It is equivalent to the -% Bitwise operators. import Int64 "mo:base/Int64"; let x : Int64 = -9_223_372_036_854_775_808; let y : Int64 = 1; Int64.subWrap(x, y) INT64.MULWRAP func mulWrap(x : Int64, y : Int64) : Int64 The function mulWrap takes two Int64 value and returns a Int64 value.It is equivalent to the *% Bitwise operators. import Int64 "mo:base/Int64"; let x : Int64 = 9_223_372_036_854_775_807; let y : Int64 = 2; Int64.mulWrap(x, y) INT64.POWWRAP func powWrap(x : Int64, y : Int64) : Int64 The function powWrap takes two Int64 value and returns a Int64 value.It is equivalent to the **% Bitwise operators. import Int64 "mo:base/Int64"; let x : Int64 = 4294967296; let y : Int64 = 2; Int64.powWrap(x, y)