Skip to content

Commit

Permalink
Bindings for adjacent fix-width numerical conversions and flesh out d…
Browse files Browse the repository at this point in the history
…ocs (#585)

Expose these new primitives to convert between adjacent fix-width types:

- `Int8`
- `Int16`
- `Int32`
- `Int64`

- `Nat8`
- `Nat16`
- `Nat32`
- `Nat64`

And fleshing out the documentation for these modules to be up to
standard with the `Nat` and `Int` modules.
  • Loading branch information
kentosugama authored Aug 21, 2023
1 parent 085468f commit 452b7db
Show file tree
Hide file tree
Showing 9 changed files with 2,864 additions and 668 deletions.
5 changes: 5 additions & 0 deletions src/Int.mo
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ module {
/// ```motoko include=import
/// Int.neg(123) // => -123
/// ```
///
/// Note: The reason why this function is defined in this library (in addition
/// to the existing `-` operator) is so that you can use it as a function
/// value to pass to a higher order function. It is not possible to use `-`
/// as a function value at the moment.
public func neg(x : Int) : Int { -x };

/// Returns the sum of `x` and `y`, `x + y`.
Expand Down
Loading

0 comments on commit 452b7db

Please sign in to comment.