Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions src/gleam/float.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ pub fn random() -> Float
/// Returns division of the inputs as a `Result`: If the given divisor equals
/// `0`, this function returns an `Error`.
///
/// The computed value will always have the same sign as the `divisor`.
///
/// ## Examples
///
/// ```gleam
Expand Down
9 changes: 7 additions & 2 deletions src/gleam/int.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,8 @@ pub fn remainder(dividend: Int, by divisor: Int) -> Result(Int, Nil) {
/// Returns division of the inputs as a `Result`: If the given divisor equals
/// `0`, this function returns an `Error`.
///
/// Most the time you will want to use the `%` operator instead of this
/// function.
/// Note that this is different from `int.remainder` and `%` in that the
/// computed value will always have the same sign as the `divisor`.
///
/// ## Examples
///
Expand Down Expand Up @@ -624,6 +624,11 @@ pub fn remainder(dividend: Int, by divisor: Int) -> Result(Int, Nil) {
/// // -> Ok(2)
/// ```
///
/// ```gleam
/// modulo(13, by: -3)
/// // -> Ok(-2)
/// ```
///
pub fn modulo(dividend: Int, by divisor: Int) -> Result(Int, Nil) {
case divisor {
0 -> Error(Nil)
Expand Down