• 2 Posts
  • 41 Comments
Joined 1 month ago
cake
Cake day: June 2nd, 2024

help-circle








  • json doesn’t have ints, it has Numbers, which are ieee754 floats.

    No. numbers in JSON have arbitrary precision. The standard only specifies that implementations may impose restrictions on the allowed values.

    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.

    https://www.rfc-editor.org/rfc/rfc8259.html#section-6







  • I’m not sure if you’re getting it, so I’ll explain just in case.

    In computer science a few conventions have emerged on how numbers should be interpreted, depending on how they start:

    • decimal (the usual system with digits from 0 to 9): no prefix
    • binary (digits 0 and 1): prefix 0b, so 0b1001110
    • octal (digits 0 through 7): prefix 0, so 0116
    • hexadecimal (digits 0 through 9 and then A through E): prefix 0x, so 0x8E

    If your zip code starts with 9, it won’t be interpreted as octal. You’re fine.