Skip to content

Commit

Permalink
doc: updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
korbexmachina committed Mar 26, 2024
1 parent c90803e commit 9923e4b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/gcalc.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ pub fn abs(n: Float) -> Float {
/// or an error if the argument is negative
///
/// Note: This function only supports non-negative values
/// and returns the floor of the result
/// (i.e. the largest integer less than or equal to the result)
///
/// Example:
/// ```gleam
/// sqrt(4.0) // Ok(2.000000000000002)
/// |> result.unwrap(0.0) // 2.000000000000002
/// |> float.floor // 2.0
/// ```
pub fn sqrt(n: Float) -> Result(Float, MathError) {
case n <. 0.0 {
True -> Error(ValueOutOfRange)
Expand Down

0 comments on commit 9923e4b

Please sign in to comment.