aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan M. Moore <rmm1047@gmail.com>2024-12-30 22:24:24 -0500
committerLouis Pilfold <louis@lpil.uk>2025-01-03 20:45:47 +0000
commitced490f266237ee97420d8a63f541c6ebcb92035 (patch)
tree761d1b74cfa4bca16ec2fe48225338803b17fd58
parent619935a6e79dce3262712838c4cb1c1b69f33132 (diff)
downloadgleam_stdlib-ced490f266237ee97420d8a63f541c6ebcb92035.tar.gz
gleam_stdlib-ced490f266237ee97420d8a63f541c6ebcb92035.zip
Add float representation info to module docs
Addresses #783.
-rw-r--r--src/gleam/float.gleam17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gleam/float.gleam b/src/gleam/float.gleam
index 6aeeac7..8d42738 100644
--- a/src/gleam/float.gleam
+++ b/src/gleam/float.gleam
@@ -1,4 +1,21 @@
//// Functions for working with floats.
+////
+//// ## Float representation
+////
+//// Floats are represented as 64 bit floating point numbers on both the Erlang
+//// and JavaScript runtimes. The floating point behaviour is native to their
+//// respective runtimes, so their exact behaviour will be slightly different on
+//// the two runtimes.
+////
+//// ### Infinity and NaN
+////
+//// Under the JavaScript runtime, exceeding the maximum (or minimum)
+//// representable value for a floating point value will result in Infinity (or
+//// -Infinity). Should you try to divide two infinities you will get NaN as a
+//// result.
+////
+//// When running on BEAM, exceeding the maximum (or minimum) representable
+//// value for a floating point value will raise an error.
////
//// ## Division by zero
////