aboutsummaryrefslogtreecommitdiff
path: root/src/gleam_stdlib.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gleam_stdlib.mjs')
-rw-r--r--src/gleam_stdlib.mjs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gleam_stdlib.mjs b/src/gleam_stdlib.mjs
index 4f804f7..339963b 100644
--- a/src/gleam_stdlib.mjs
+++ b/src/gleam_stdlib.mjs
@@ -1010,3 +1010,16 @@ export function bit_array_starts_with(bits, prefix) {
return true;
}
+
+export function log(x) {
+ // It is checked in Gleam that:
+ // - The input is strictly positive (x > 0)
+ // - This ensures that Math.log will never return NaN or -Infinity
+ // The function can thus safely pass the input to Math.log
+ // and a valid finite float will always be produced.
+ return Math.log(x);
+}
+
+export function exp(x) {
+ return Math.exp(x);
+}