From aefecd6b6a923643bf6ee6e519804d9688803516 Mon Sep 17 00:00:00 2001 From: pommicket Date: Tue, 9 Sep 2025 11:52:36 -0400 Subject: Reduce integer limit to 2^53-1 --- site/spec.html | 32 +++++++++++++++++++------------- tests/interpretation/int.pom | 18 ++++++++++-------- tests/interpretation/uint.pom | 9 +++++---- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/site/spec.html b/site/spec.html index f3178fd..805dcd1 100644 --- a/site/spec.html +++ b/site/spec.html @@ -470,23 +470,29 @@ and for my.nephews.car.id is String (no schema key matches, so the default of St
  • String — accepts any value
  • None — accepts an unset value (special—see below)
  • Empty — accepts an empty value
  • -
  • Bool — accepts true, on, yes, - false, off, no (case- and white space- sensitive).
  • -
  • UInt — accepts any unsigned integer strictly less than 263, +
  • + Bool — accepts true, on, yes, + false, off, no (case- and white space- sensitive). +
  • +
  • + UInt — accepts any unsigned integer strictly less than 253, written in decimal or 0x or 0X-prefixed hexadecimal. A leading + is permitted, but -0 is not. Leading zeroes are not permitted for decimal integers. White space around the integer is not permitted. - Only 63 bits are allowed to support languages (Java) with no 64-bit unsigned integers.
  • -
  • Int — accepts any (two’s complement) signed integer whose absolute value - is strictly less than 263 - (NB: INT64_MIN/−263 is not allowed), - written in decimal or 0x or 0X-prefixed hexadecimal. + Only 53 bits are allowed to support languages (JavaScript) with + a double type, but no 64-bit integer type. +
  • +
  • + Int — accepts any signed integer whose absolute value + is strictly less than 253, written in decimal or + 0x or 0X-prefixed hexadecimal. Leading zeroes are not permitted for decimal integers. White space around the integer is not permitted. - A leading + (or, of course, -) is permitted.
  • -
  • Float — - A floating-point number, written in ordinary decimal + A leading + (or, of course, -) is permitted. +
  • +
  • + Float — A floating-point number, written in ordinary decimal (e.g. -1.234, 7., 265) or in scientific notation (e.g. 3e5, 3.E-5, -3.7e+5). Excessive leading zeroes are not permitted (0.0 is allowed, but not 00.0). @@ -633,7 +639,7 @@ and for my.nephews.car.id is String (no schema key matches, so the default of St get_int(conf: Configuration, key: String) -> Optional<Int>
    get_int_or_default(conf: Configuration, key: String, default: Int) -> Int
    Get value associated with key, - if any exists, and parse it as a signed 64-bit integer, + if any exists, and parse it as a signed integer, following the Int schema type described above (returning default if the key doesn’t exist). Returns an error if the key exists but its value is not a valid signed 64-bit integer. @@ -642,7 +648,7 @@ and for my.nephews.car.id is String (no schema key matches, so the default of St get_uint(conf: Configuration, key: String) -> Optional<UInt>
    get_uint_or_default(conf: Configuration, key: String, default: UInt) -> UInt
    Get value associated with key, if any exists, - and parse it as an unsigned 63-bit [sic] integer, + and parse it as an unsigned integer, following the UInt schema type described above (returning default if the key doesn’t exist). Returns an error if the key exists but its value is not a valid unsigned 63-bit integer. diff --git a/tests/interpretation/int.pom b/tests/interpretation/int.pom index 7158dc2..f2f6243 100644 --- a/tests/interpretation/int.pom +++ b/tests/interpretation/int.pom @@ -24,11 +24,11 @@ hex.b = 74751 negative_hex.a = -0Xfade negative_hex.b = -64222 -largest.a = 9223372036854775807 -largest.b = 0x7fffffffffffffff +largest.a = 9007199254740991 +largest.b = 0x1fffffffffffff -smallest.a = -9223372036854775807 -smallest.b = -0x7fffffffffffffff +smallest.a = -9007199254740991 +smallest.b = -0x1fffffffffffff [bad] space_three = " 3" @@ -41,7 +41,9 @@ multi_sign = -+3 multi_sign2 = +-3 multi_sign3 = ++3 multi_sign4 = --3 -too_large = 9223372036854775808 -too_large_hex = 0x8000000000000000 -too_small = -9223372036854775808 -too_small_hex = -0x8000000000000000 +too_large = 9007199254740992 +too_large_hex = 0x20000000000000 +much_too_large = 9999999999999999 +too_small = -9007199254740992 +too_small_hex = -0x20000000000000 +much_too_small = -9999999999999999 diff --git a/tests/interpretation/uint.pom b/tests/interpretation/uint.pom index be15211..e762022 100644 --- a/tests/interpretation/uint.pom +++ b/tests/interpretation/uint.pom @@ -21,8 +21,8 @@ hex.b = 74751 hex2.a = 0Xfade hex2.b = 64222 -largest.a = 9223372036854775807 -largest.b = 0x7fffffffffffffff +largest.a = 9007199254740991 +largest.b = 0x1fffffffffffff [bad] space_three = " 3" @@ -33,6 +33,7 @@ trailing_dec = 35a trailing_hex = 0x35g decimal = 3.0 multi_sign = ++3 -too_large = 9223372036854775808 -too_large_hex = 0x8000000000000000 +too_large = 9007199254740992 +too_large_hex = 0x20000000000000 +much_too_large = 9999999999999999 negative_zero = -0 -- cgit v1.2.3