aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gleam/float.gleam14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gleam/float.gleam b/src/gleam/float.gleam
index c85903f..3767113 100644
--- a/src/gleam/float.gleam
+++ b/src/gleam/float.gleam
@@ -128,3 +128,17 @@ pub external fn truncate(Float) -> Int =
///
pub external fn absolute_value(Float) -> Float =
"erlang" "abs"
+
+/// Returns the results of the base being raised to the power of the
+/// exponent, as a float.
+///
+/// ## Examples
+///
+/// > power(2.0, 2.0)
+/// 4.0
+///
+/// > power(8.0, 1.5)
+/// 64.0
+///
+pub external fn power(base: Float, exponent: Float) -> Float =
+ "math" "pow"