!lymvtcwDJ7ZA9Npq:lix.systems

Lix Development

422 Members
(Technical) development of Lix, the package manager, a Nix implementation. Please be mindful of ongoing technical conversations in this channel.143 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
14 Aug 2025
@emilazy:matrix.orgemily *

the latest RFC defines a single numeric type and says

   This specification allows implementations to set limits on the range
   and precision of numbers accepted.  Since software that implements
   IEEE 754 binary64 (double precision) numbers [IEEE754] is generally
   available and widely used, good interoperability can be achieved by
   implementations that expect no more precision or range than these
   provide, in the sense that implementations will approximate JSON
   numbers within the expected precision.  A JSON number such as 1E400
   or 3.141592653589793238462643383279 may indicate potential
   interoperability problems, since it suggests that the software that
   created it expects receiving software to have greater capabilities
   for numeric magnitude and precision than is widely available.

   Note that when such software is used, numbers that are integers and
   are in the range [-(2**53)+1, (2**53)-1] are interoperable in the
   sense that implementations will agree exactly on their numeric
   values.
15:37:16
@emilazy:matrix.orgemilythere is an RFC that subsets it into an interoperable subset that IIRC they say that IETF specifications SHOULD use; I believe it limits the range to the interoperable subset15:37:39
@emilazy:matrix.orgemilybut I'd have to check15:37:42
@emilazy:matrix.orgemily Nix could just always parse numeric literals in JSON into floats, but it would be annoying. (especially since Nixpkgs backs its integer-parsing functions by fromJSON) 15:38:05
@weethet:catgirl.cloudWeetHet
In reply to @raitobezarius:matrix.org
In ~ 5 days, yeah
Thanks
15:38:15
@emilazy:matrix.orgemily

ok, I-JSON says

   Software that implements IEEE 754-2008 binary64 (double precision)
   numbers [IEEE754] is generally available and widely used.
   Implementations that generate I-JSON messages cannot assume that
   receiving implementations can process numeric values with greater
   magnitude or precision than provided by those numbers.  I-JSON
   messages SHOULD NOT include numbers that express greater magnitude or
   precision than an IEEE 754 double precision number provides, for
   example, 1E400 or 3.141592653589793238462643383279.

   An I-JSON sender cannot expect a receiver to treat an integer whose
   absolute value is greater than 9007199254740991 (i.e., that is
   outside the range [-(2**53)+1, (2**53)-1]) as an exact value.

   For applications that require the exact interchange of numbers with
   greater magnitude or precision, it is RECOMMENDED to encode them in
   JSON string values.  This requires that the receiving program
   understand the intended semantic of the value.  An example would be
   64-bit integers, even though modern hardware can deal with them,
   because of the limited scope of JavaScript numbers.
15:38:53
@emilazy:matrix.orgemilyok, Nixpkgs does in fact detect the float case for integer conversions15:39:36

Show newer messages


Back to Room ListRoom Version: 10