-module(eyg@ir@integer). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/eyg/ir/integer.gleam"). -export([is_safe/1]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC( " EYG integers are native machine integers, chosen for speed. On Erlang\n" " they are arbitrary-precision bignums; on JavaScript they are IEEE-754\n" " doubles, which only represent integers in the safe range exactly.\n" "\n" " `is_safe` lets the places that ingest an integer from an external\n" " representation (the parser, the DAG-JSON decoder, `int_parse`) reject a\n" " value that the current target can't hold exactly, so out-of-range input\n" " fails loudly instead of silently rounding.\n" ). -file("src/eyg/ir/integer.gleam", 15). ?DOC( " True when the integer is exactly representable on the current target. On\n" " Erlang every integer is exact, so this is always True (the body below). On\n" " JavaScript only the safe-integer range (magnitude <= 2^53 - 1) is exact,\n" " matching `Number.isSafeInteger` (the FFI below).\n" ). -spec is_safe(integer()) -> boolean(). is_safe(_) -> true.