Skip to content

Conversation

cschembor3
Copy link
Contributor

Overview

This PR attempts to address some of what was discussed in #100 aimed at the float module.

Implementation

This PR adds the following functions to the float module:

  • absolute_value
  • square_root
  • power

In terms of implementation, abs is available as a BIF in erlang, so I am just making an external call to that. The square root and power functions were also simple enough that I thought it would be fine to make these external calls to the erlang stdlib as well.

Please let me know any thoughts/criticisms/opinions regarding this.

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thank you. Would you mind also updating the CHANGELOG?

cschembor3 and others added 4 commits August 27, 2020 08:37
This adds a function for evaluating exponents for floats. Calls the erlang math module function
@cschembor3
Copy link
Contributor Author

Sure thing! Updated the changelog, as well as rebased onto main.

@lpil
Copy link
Member

lpil commented Aug 27, 2020

Thank you!

@lpil lpil merged commit 8c8f94b into gleam-lang:main Aug 27, 2020
/// ## Examples
///
/// > square_root(4.0)
/// 2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cschembor3 should this not be Ok(2.0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah you're totally right. Just opened #104 to address this. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants