From ced490f266237ee97420d8a63f541c6ebcb92035 Mon Sep 17 00:00:00 2001 From: "Ryan M. Moore" Date: Mon, 30 Dec 2024 22:24:24 -0500 Subject: Add float representation info to module docs Addresses #783. --- src/gleam/float.gleam | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 //// -- cgit v1.2.3