{
  "context": "# Decimal-to-binary64 parsing\n\n## Scope and vocabulary\n\nThe subject is the `f64` specialization of Rust's decimal parser and its\nhelper functions, including executions with integer overflow checks enabled.\nPublic results are the returned floats and errors.\n\nA numeric literal has an optional leading sign, an ASCII decimal significand\nwith at least one digit and at most one decimal point, and an optional `e` or\n`E` exponent with an optional sign and at least one ASCII digit. Special\nliterals are `inf`, `infinity`, and `nan`, matched ASCII case-insensitively,\nwith an optional leading sign. The whole input must match; whitespace and\nother extra characters are invalid. An unsigned literal omits the leading\nsign, while its exponent may still have a sign.\n\nThe exact value of a numeric literal is its ordinary mathematical decimal\nvalue. Rounding means IEEE 754 binary64 round-to-nearest, ties-to-even,\nincluding subnormal results, signed zero, and overflow to infinity.\n\nFor auxiliary claims, the **accumulated-exponent value** retains every\nsignificand digit but interprets the explicit exponent using the source's\nbounded exponent-accumulation rule. This is an implementation-level diagnostic\nvalue, distinct from the exact value required by the public contract.",
  "goals": [
    {
      "id": "parser_nan_acceptance",
      "text": "`dec2flt`\n\n**NaN acceptance.** Every NaN literal returns `Ok` of a float satisfying\n`is_nan()`."
    },
    {
      "id": "parser_infinity",
      "text": "`dec2flt`\n\n**Infinity.** Every infinity literal returns `Ok` of the infinity with its\nlexical sign."
    },
    {
      "id": "parser_non_nan_results",
      "text": "`dec2flt`\n\n**No spurious NaNs.** Every successful result for an input other than a NaN\nliteral is not NaN."
    },
    {
      "id": "parser_numeric_sign",
      "text": "`dec2flt`\n\n**Numeric sign.** Every successful numeric result has the literal's lexical\nsign, including results that underflow to zero or overflow to infinity."
    },
    {
      "id": "parser_signed_zero",
      "text": "`dec2flt`\n\n**Signed zero.** On acceptance, a numeric literal denoting zero returns\nzero with its lexical sign."
    },
    {
      "id": "parser_selected_exponent",
      "text": "`dec2flt`\n\n**Selected exponent range.** On a successful numeric parse, each raw pair\nselected by the dispatcher for final float assembly has a biased exponent\nin `0..=2047`."
    },
    {
      "id": "parser_selected_magnitude_sign",
      "text": "`dec2flt`\n\n**Selected magnitude sign.** On a successful numeric parse, the assembled\nword of each raw pair selected for final float assembly has a clear sign bit."
    },
    {
      "id": "number_helper_record_bounds",
      "text": "`parse_number`\n\n**Record bounds.** For every nonempty byte slice, any returned record has\n`negative = false` and `mantissa < 10^19`."
    },
    {
      "id": "special_helper_infinity",
      "text": "`parse_inf_nan`\n\n**Infinity.** For every byte slice and either value of the separate sign\nargument, an unsigned infinity keyword returns `Some` infinity with that sign."
    },
    {
      "id": "special_helper_nan",
      "text": "`parse_inf_nan`\n\n**NaN.** For every byte slice and either value of the separate sign argument,\nan unsigned NaN keyword returns `Some` of a NaN."
    },
    {
      "id": "special_helper_rejection",
      "text": "`parse_inf_nan`\n\n**Rejection.** For every byte slice and either value of the separate sign\nargument, an input other than an unsigned `inf`, `infinity`, or `nan` keyword\nreturns `None`."
    },
    {
      "id": "native_correct_or_defer",
      "text": "`try_fast_path`\n\n**Native correctness or defer.** For every `Decimal` record, on normal return,\nthe result is either `None` or `Some` of the binary64 rounding of the exact\n`mantissa * 10^exponent`, with the record's sign. A `Some` result also implies\n`many_digits = false`. The contract applies to both the ordinary native path\nand the disguised path that transfers powers of ten into the mantissa."
    },
    {
      "id": "integer_correct_or_defer",
      "text": "`compute_float`\n\n**Correctness or defer.** For all `i64` exponents `q` and all `u64` mantissas\n`w`, a normal result is either a pair with negative biased exponent (deferral)\nor a pair whose assembled word is the nonnegative binary64 rounding of the\nexact value `w * 10^q`."
    },
    {
      "id": "slow_accumulated_rounding",
      "text": "`parse_long_mantissa`\n\n**Full-significand diagnostic.** For every unsigned numeric literal, a normal\nresult is a pair whose assembled word is the nonnegative binary64 rounding\nof its accumulated-exponent value, retaining the full significand's\ncontribution to rounding."
    },
    {
      "id": "assembly_correspondence",
      "text": "`biased_fp_to_float`\n\n**Assembly correspondence.** For every `BiasedFp`, the function returns\nnormally with float bits equal to the bitwise OR of its mantissa and its\nbiased exponent cast to `u64` using Rust semantics and shifted left by 52.\nThe word interpretation used in the other obligations agrees with this\noperation for all field values, without a well-formedness precondition."
    },
    {
      "id": "classification_totality",
      "text": "Mathematical specification\n\n**Classification totality.** Every finite byte string is classified as\nnumeric, special, or invalid."
    },
    {
      "id": "classification_determinism",
      "text": "Mathematical specification\n\n**Classification determinism.** Every finite byte string has at most one\nclassification, and the parsed content of each numeric literal is unique."
    },
    {
      "id": "classification_significand_digit",
      "text": "Mathematical specification\n\n**Significand digit.** Every numeric literal contains a significand digit."
    },
    {
      "id": "rounding_totality",
      "text": "Mathematical specification\n\n**Rounding totality.** Every nonnegative real has a binary64 magnitude\nrounding target, finite or infinite."
    },
    {
      "id": "rounding_determinism",
      "text": "Mathematical specification\n\n**Rounding determinism.** For every nonnegative real, the binary64 magnitude\nrounding target is unique."
    },
    {
      "id": "exponent_value_agreement",
      "text": "Mathematical specification\n\n**Exponent agreement.** For every numeric literal whose accumulated explicit\nexponent equals its mathematical explicit exponent, exact and\naccumulated-exponent rounding agree."
    },
    {
      "id": "dispatch_abstract_composition",
      "text": "`dec2flt`\n\n**Conditional abstract composition.** Let A = 3458764513820540928 bytes and B = 576460752303421440 bytes. The lexical and conversion component contracts admit implementations, with numeric lexical acceptance, rejection and record representation required for nonempty source-valid byte slices of length at most A, and preservation of the ordinary mathematical exact rounding target required for numeric inputs of length at most B. Special parsing, native correctness-or-defer, integer correctness-or-defer, unrestricted assembly, and the full-significand accumulated-exponent slow diagnostic retain their existing domains; the slow diagnostic applies to every source-valid unsigned numeric literal, without an A or B restriction. For any components satisfying these contracts, the dispatcher's normal results on Rust strings of byte length at most A satisfy classification, accumulated-exponent rounding and lexical sign requirements. On numeric strings of byte length at most B they additionally satisfy ordinary mathematical exact rounding. These conclusions include the native shortcut, integer tier, many-digit endpoint decision, fallback, sign handling and final assembly. Contract inhabitability and the existence of an abstract normal output for every Rust string of byte length at most A must be established, not inferred from an implication over an empty contract package."
    },
    {
      "id": "dispatch_component_compliance",
      "text": "`dec2flt`\n\n**Conditional component compliance.** Let A = 3458764513820540928 bytes and B = 576460752303421440 bytes. The actual source components satisfy the contracts used in conditional abstract composition. In particular, the numeric lexical component returns normally and satisfies acceptance, rejection and record representation on every nonempty source-valid byte slice of length at most A; it preserves the input's ordinary mathematical exact rounding target on numeric slices of length at most B. The source components for special parsing, native conversion, integer conversion and unrestricted assembly retain their existing full-domain obligations. The actual slow component satisfies the full-significand accumulated-exponent diagnostic on every source-valid unsigned numeric literal, without a length restriction. For every Rust string of byte length at most A, the concrete dispatcher agrees with the abstract component operations at its calls and establishes their helper preconditions. On numeric strings of byte length at most B, this agreement additionally preserves the exact rounding target throughout dispatch. These obligations include native shortcut, integer tier, many-digit decision, fallback, sign handling and assembly, and require a genuinely inhabited compatible component package."
    },
    {
      "id": "number_helper_acceptance",
      "text": "`parse_number`\n\n**Conditional numeric acceptance.** Every nonempty source-valid byte slice of length at most 3458764513820540928 bytes that forms an unsigned numeric literal returns normally with `Some`. This requirement includes executions with integer overflow checks enabled and does not impose a limit on the number or mathematical value of explicit exponent digits within the stated byte-length domain."
    },
    {
      "id": "number_helper_rejection",
      "text": "`parse_number`\n\n**Conditional invalid rejection.** Every nonempty source-valid byte slice of length at most 3458764513820540928 bytes that is not an unsigned numeric literal returns normally with `None`, including executions with integer overflow checks enabled. The entire byte slice must be checked against the unsigned numeric grammar, including malformed exponent digits and trailing characters after exponent accumulation has stopped."
    },
    {
      "id": "parser_exact_rounding",
      "text": "`dec2flt`\n\n**Conditional exact rounding.** On acceptance of any numeric literal whose complete Rust string has byte length at most 576460752303421440 bytes, the returned float is its ordinary mathematical exact decimal value rounded to binary64 round-to-nearest, ties-to-even. This includes subnormal results, signed zero with the literal's lexical sign, and overflow to infinity with that sign. The explicit exponent has its ordinary mathematical meaning; no restriction on its digit count or value is added beyond the stated complete-string byte-length bound."
    },
    {
      "id": "parser_invalid_rejection",
      "text": "`dec2flt`\n\n**Conditional invalid rejection.** Every Rust string of byte length at most 3458764513820540928 bytes that is outside the numeric and special literal grammar returns normally with `Err`, without panicking, including executions with integer overflow checks enabled. Grammar matching covers the whole input, including characters after a numerically saturated exponent."
    },
    {
      "id": "parser_numeric_acceptance",
      "text": "`dec2flt`\n\n**Conditional numeric acceptance.** Every numeric literal whose complete Rust string has byte length at most 3458764513820540928 bytes returns normally with `Ok`, without panicking, including executions with integer overflow checks enabled. Optional leading signs and arbitrarily long explicit exponent digit strings are allowed whenever the complete string satisfies the stated byte-length bound."
    },
    {
      "id": "parser_totality",
      "text": "`dec2flt`\n\n**Conditional totality.** For every Rust string of byte length at most 3458764513820540928 bytes, the function terminates normally with a float result or parsing error, without panicking. This requirement includes executions with integer overflow checks enabled and applies to numeric, special, invalid, empty and sign-only inputs."
    },
    {
      "id": "parser_accumulated_rounding",
      "text": "`dec2flt`\n\n**Conditional accumulated-value diagnostic.** Every accepted numeric literal whose complete Rust string has byte length at most 3458764513820540928 bytes is rounded to its accumulated-exponent value, retaining every significand digit and interpreting the explicit exponent using the actual source's bounded exponent-accumulation rule. The returned binary64 float has the literal's lexical sign, including zero and infinity. This diagnostic is distinct from the ordinary mathematical exact-value requirement."
    },
    {
      "id": "parser_equal_target_rounding",
      "text": "`dec2flt`\n\n**Conditional equal-target bridge.** On acceptance of a numeric literal whose complete Rust string has byte length at most 3458764513820540928 bytes and whose ordinary mathematical exact value and source-defined accumulated-exponent value have the same binary64 rounding target, the result has that target and the literal's lexical sign, including signed zero and signed infinity."
    },
    {
      "id": "number_helper_accumulated_value",
      "text": "`parse_number`\n\n**Conditional accumulated-value diagnostic.** For every source-valid unsigned numeric byte slice of length at most 3458764513820540928 bytes, any returned record with `many_digits = false` represents its accumulated-exponent value exactly as `mantissa * 10^exponent`. With `many_digits = true`, that value lies in the half-open interval from `mantissa * 10^exponent` to `(mantissa + 1) * 10^exponent`. The accumulated-exponent value retains every significand digit and uses the actual source's bounded explicit-exponent accumulation rule."
    }
  ]
}
