--- a/dec2flt/decimal_seq.rs
+++ b/dec2flt/decimal_seq.rs
@@ -10,6 +10,7 @@
 //! available online: <https://nigeltao.github.io/blog/2020/parse-number-f64-simple.html>.
 
 use dec2flt::common::{ByteSlice, is_8digits};
+use dec2flt::parse::parse_scientific;
 
 use crate::num::imp::dec2flt;
 
@@ -218,10 +219,27 @@
     }
 }
 
+/// Combine source-valid counts before encoding an extreme point for the slow guards.
+#[inline]
+pub(super) fn final_decimal_point(
+    significant_count: usize,
+    fractional_count: usize,
+    explicit: i64,
+) -> i32 {
+    if significant_count == 0 {
+        return 0;
+    }
+    let base = significant_count as i64 - fractional_count as i64;
+    base.saturating_add(explicit)
+        .clamp(-(DecimalSeq::DECIMAL_POINT_RANGE as i64), DecimalSeq::DECIMAL_POINT_RANGE as i64)
+        as i32
+}
+
 /// Parse a big integer representation of the float as a decimal.
 pub fn parse_decimal_seq(mut s: &[u8]) -> DecimalSeq {
     let mut d = DecimalSeq::default();
     let start = s;
+    let mut fractional_count = 0;
 
     while let Some((&b'0', s_next)) = s.split_first() {
         s = s_next;
@@ -248,9 +266,10 @@
             s = &s[8..];
         }
         s = s.parse_digits(|digit| d.try_add_digit(digit));
-        d.decimal_point = s.len() as i32 - first.len() as i32;
-    }
-
+        fractional_count = first.len() - s.len();
+    }
+
+    let significant_count = d.num_digits;
     if d.num_digits != 0 {
         // Ignore the trailing zeros if there are any
         let mut n_trailing_zeros = 0;
@@ -261,36 +280,21 @@
                 break;
             }
         }
-        d.decimal_point += n_trailing_zeros as i32;
         d.num_digits -= n_trailing_zeros;
-        d.decimal_point += d.num_digits as i32;
         if d.num_digits > DecimalSeq::MAX_DIGITS {
             d.truncated = true;
             d.num_digits = DecimalSeq::MAX_DIGITS;
         }
     }
 
+    let mut explicit = 0;
     if let Some((&ch, s_next)) = s.split_first() {
         if ch == b'e' || ch == b'E' {
             s = s_next;
-            let mut neg_exp = false;
-            if let Some((&ch, s_next)) = s.split_first() {
-                neg_exp = ch == b'-';
-                if ch == b'-' || ch == b'+' {
-                    s = s_next;
-                }
-            }
-            let mut exp_num = 0_i32;
-
-            s.parse_digits(|digit| {
-                if exp_num < 0x10000 {
-                    exp_num = 10 * exp_num + digit as i32;
-                }
-            });
-
-            d.decimal_point += if neg_exp { -exp_num } else { exp_num };
-        }
-    }
+            explicit = parse_scientific(&mut s).unwrap_or(0);
+        }
+    }
+    d.decimal_point = final_decimal_point(significant_count, fractional_count, explicit);
 
     for i in d.num_digits..DecimalSeq::MAX_DIGITS_WITHOUT_OVERFLOW {
         d.digits[i] = 0;
--- a/dec2flt/parse.rs
+++ b/dec2flt/parse.rs
@@ -70,7 +70,7 @@
 }
 
 /// Parse the scientific notation component of a float.
-fn parse_scientific(s_ref: &mut &[u8]) -> Option<i64> {
+pub(super) fn parse_scientific(s_ref: &mut &[u8]) -> Option<i64> {
     let mut exponent = 0i64;
     let mut negative = false;
 
@@ -85,8 +85,8 @@
 
     if matches!(s.first(), Some(&x) if x.is_ascii_digit()) {
         *s_ref = s.parse_digits(|digit| {
-            // no overflows here, saturate well before overflow
-            if exponent < 0x10000 {
+            // The pre-update cutoff permits one overshoot, bounded by 10 * 2^59 - 1.
+            if exponent < (1_i64 << 59) {
                 exponent = 10 * exponent + digit as i64;
             }
         });
--- /dev/null
+++ b/regression/bench.rs
@@ -0,0 +1,96 @@
+//! Offline timing only; construction, formatting and checksums are outside samples.
+use crate::dec2flt;
+use std::hint::black_box;
+use std::io::{self, BufRead};
+use std::time::Instant;
+
+const MIN_NS: u128 = 15_000_000;
+
+fn decode(s: &str) -> Vec<u8> {
+    assert_eq!(s.len() % 2, 0);
+    (0..s.len()).step_by(2)
+        .map(|i| u8::from_str_radix(&s[i..i + 2], 16).unwrap()).collect()
+}
+
+fn hash(s: &str) -> u64 {
+    s.bytes().fold(0xcbf29ce484222325, |h, b| (h ^ b as u64).wrapping_mul(0x100000001b3))
+}
+
+fn elapsed<F, I, R>(f: &F, input: I, iterations: u64) -> u128
+where F: Fn(I) -> R, I: Copy {
+    let start = Instant::now();
+    for _ in 0..iterations {
+        black_box(f(black_box(input)));
+    }
+    start.elapsed().as_nanos()
+}
+
+fn samples<F, I, R>(name: &str, operation: &str, f: F, input: I, result: &str)
+where F: Fn(I) -> R, I: Copy {
+    println!("R\t{name}\t{operation}\t{result}");
+    let checksum = hash(result);
+    let mut iterations = 1_u64;
+    // Calibration and warmup are discarded. Every retained sample is >=15ms.
+    while elapsed(&f, input, iterations) < MIN_NS {
+        iterations = iterations.checked_mul(2).unwrap();
+        assert!(iterations < (1_u64 << 50));
+    }
+    for sample in 0..5 {
+        let mut ns = elapsed(&f, input, iterations);
+        while ns < MIN_NS {
+            iterations = iterations.checked_mul(2).unwrap();
+            assert!(iterations < (1_u64 << 50));
+            ns = elapsed(&f, input, iterations);
+        }
+        println!("S\t{name}\t{operation}\t{sample}\t{iterations}\t{ns}\t{checksum:016x}");
+    }
+}
+
+#[inline(never)]
+fn public(input: &str) -> Result<f64, crate::num::ParseFloatError> {
+    dec2flt::dec2flt::<f64>(input)
+}
+
+#[inline(never)]
+fn number(input: &[u8]) -> Option<dec2flt::decimal::Decimal> {
+    dec2flt::parse::parse_number(input)
+}
+
+#[inline(never)]
+fn sequence(input: &[u8]) -> dec2flt::decimal_seq::DecimalSeq {
+    dec2flt::decimal_seq::parse_decimal_seq(input)
+}
+
+#[inline(never)]
+fn slow(input: &[u8]) -> dec2flt::common::BiasedFp {
+    dec2flt::slow::parse_long_mantissa::<f64>(input)
+}
+
+pub fn run() {
+    let inputs: Vec<_> = io::stdin().lock().lines().map(|line| {
+        let line = line.unwrap();
+        let (name, hex) = line.split_once('\t').unwrap();
+        (name.to_owned(), decode(hex))
+    }).collect();
+    for (name, input) in inputs {
+        assert!(!input.is_empty());
+        let text = std::str::from_utf8(&input).unwrap();
+        let value = match public(text) {
+            Ok(f) => format!("{:016x}", f.to_bits()),
+            Err(e) => format!("ERR:{:?}", e.kind),
+        };
+        samples(&name, "public", public, text, &value);
+        let value = match number(&input) {
+            Some(d) => format!("{},{},{},{}", d.mantissa, d.exponent, d.negative, d.many_digits),
+            None => "NONE".into(),
+        };
+        samples(&name, "parse_number", number, input.as_slice(), &value);
+        let d = sequence(&input);
+        let digits: String = d.digits[..d.num_digits].iter().map(|d| char::from(b'0' + d)).collect();
+        let value = format!("{},{},{},{}", d.num_digits, d.decimal_point, d.truncated, digits);
+        samples(&name, "parse_decimal_seq", sequence, input.as_slice(), &value);
+        let fp = slow(&input);
+        let value = format!("{:016x},{},{}", dec2flt::regression_assemble(fp).to_bits(), fp.m, fp.p_biased);
+        samples(&name, "slow", slow, input.as_slice(), &value);
+    }
+}
--- /dev/null
+++ b/regression/cases.rs
@@ -0,0 +1,68 @@
+//! Probe only: expected values and all assertions live in the independent driver.
+use std::io::{self, BufRead};
+use crate::dec2flt;
+
+fn decode(s: &str) -> Vec<u8> {
+    assert_eq!(s.len() % 2, 0);
+    (0..s.len()).step_by(2)
+        .map(|i| u8::from_str_radix(&s[i..i + 2], 16).unwrap()).collect()
+}
+
+fn bits(v: Option<f64>) -> String {
+    v.map_or_else(|| "NONE".into(), |f| format!("{:016x}", f.to_bits()))
+}
+
+pub fn run() {
+    for line in io::stdin().lock().lines() {
+        let line = line.unwrap();
+        let fields: Vec<_> = line.split('\t').collect();
+        match fields[0] {
+            "N" => {
+                let bytes = decode(fields[1]);
+                // The numeric helper's specified domain is nonempty slices.
+                let record = if bytes.is_empty() { None } else {
+                    dec2flt::parse::parse_number(&bytes)
+                };
+                let h = record.map_or_else(|| "NONE".into(), |d| {
+                    format!("{},{},{},{}", d.mantissa, d.exponent, d.negative, d.many_digits)
+                });
+                let public = match std::str::from_utf8(&bytes) {
+                    Ok(s) => match dec2flt::dec2flt::<f64>(s) {
+                        Ok(f) => format!("{:016x}", f.to_bits()),
+                        Err(e) => format!("ERR:{:?}", e.kind),
+                    },
+                    Err(_) => "UTF8".into(),
+                };
+                let special_pos = bits(dec2flt::parse::parse_inf_nan::<f64>(&bytes, false));
+                let special_neg = bits(dec2flt::parse::parse_inf_nan::<f64>(&bytes, true));
+                let (slow, seq, endpoints) = if let Some(d) = record {
+                    let fp = dec2flt::slow::parse_long_mantissa::<f64>(&bytes);
+                    let slow = dec2flt::regression_assemble(fp);
+                    let seq = dec2flt::decimal_seq::parse_decimal_seq(&bytes);
+                    let digits: String = seq.digits[..seq.num_digits].iter()
+                        .map(|d| char::from(b'0' + d)).collect();
+                    let a = dec2flt::lemire::compute_float::<f64>(d.exponent, d.mantissa);
+                    let b = dec2flt::lemire::compute_float::<f64>(d.exponent, d.mantissa + 1);
+                    (format!("{:016x}", slow.to_bits()),
+                        format!("{},{},{},{}", seq.num_digits, seq.decimal_point, seq.truncated, digits),
+                        format!("{},{},{},{}", a.m, a.p_biased, b.m, b.p_biased))
+                } else { ("NONE".into(), "NONE".into(), "NONE".into()) };
+                println!("N\t{h}\t{public}\t{special_pos}\t{special_neg}\t{slow}\t{seq}\t{endpoints}");
+            }
+            #[cfg(has_final_point)]
+            "C" => {
+                let sig: usize = fields[1].parse().unwrap();
+                let frac: usize = fields[2].parse().unwrap();
+                let mut suffix = fields[4].as_bytes();
+                let explicit = if suffix == b"ABSENT" { Some(0) } else {
+                    dec2flt::parse::parse_scientific(&mut suffix)
+                };
+                if let Some(e) = explicit {
+                    let point = dec2flt::decimal_seq::final_decimal_point(sig, frac, e);
+                    println!("C\t{e}\t{point}\t{}", suffix.len());
+                } else { println!("C\tNONE\t{}", suffix.len()); }
+            }
+            _ => panic!("unsupported probe operation"),
+        }
+    }
+}
--- /dev/null
+++ b/regression/performance.py
@@ -0,0 +1,224 @@
+#!/usr/bin/env python3
+"""Dependency-free measured comparisons; no timing tolerance implies acceptance."""
+import argparse
+import hashlib
+import json
+import os
+from pathlib import Path
+import re
+import statistics
+import subprocess
+import sys
+import tempfile
+import time
+
+import run
+
+OPERATIONS = ("public", "parse_number", "parse_decimal_seq", "slow")
+
+
+def inputs():
+    midpoint = b"1.00000000000000011102230246251565404236316680908203125"
+    result = [
+        ("short_integer", b"12345"), ("short_fraction", b"12.345"),
+        ("short_exponent", b"1.2345e12"), ("short_leading_zero", b"000000000000001.25"),
+        ("ordinary_17_digit", b"12345678901234567"),
+        ("many_digit", b"1234567890123456789012345678901234567890e-20"),
+        ("subnormal", b"2.2250738585072011e-308"), ("midpoint_fallback", midpoint),
+        ("special_inf", b"infinity"), ("special_nan", b"-NaN"),
+        ("invalid_short", b"1e+x"), ("invalid_nonascii", b"1\xc3\xa9"),
+    ]
+    for n, label in ((65536, "64KiB"), (1048576, "1MiB")):
+        result.extend([
+            ("leading_zero_" + label, b"0" * n + b"1.25"),
+            ("leading_zero_cancel_" + label, b"0." + b"0" * n + b"1e" + str(n + 1).encode()),
+            ("trailing_zero_" + label, b"1" + b"0" * n + b"e-" + str(n).encode()),
+            ("nonzero_integer_" + label, b"1" * n),
+            ("nonzero_fraction_" + label, b"0." + b"1" * n),
+            ("long_tail_" + label, midpoint + b"0" * n + b"1"),
+            ("padded_finite_fallback_" + label, b"0." + b"0" * 11 + b"1000000000000000080" + b"0" * n),
+        ])
+    for n in (1024, 65536):
+        for sign in (b"", b"-"):
+            label = str(n) + ("_negative" if sign else "_positive")
+            result.append(("saturated_exponent_" + label, b"1e" + sign + b"9" * n))
+            result.append(("invalid_saturated_" + label, b"1e" + sign + b"9" * n + b"x"))
+    return result
+
+
+def fnv(text):
+    value = 0xcbf29ce484222325
+    for byte in text.encode():
+        value = ((value ^ byte) * 0x100000001b3) & ((1 << 64) - 1)
+    return f"{value:016x}"
+
+
+def source_digest(root):
+    digest = hashlib.sha256()
+    for relative in [Path("traits.rs"), *(p.relative_to(root) for p in sorted((root / "dec2flt").glob("*.rs")))]:
+        digest.update(str(relative).encode() + b"\0" + (root / relative).read_bytes())
+    return digest.hexdigest()
+
+
+def affinity():
+    available = sorted(os.sched_getaffinity(0)) if hasattr(os, "sched_getaffinity") else []
+    if available:
+        os.sched_setaffinity(0, {2 if 2 in available else available[0]})
+    return sorted(os.sched_getaffinity(0)) if available else []
+
+
+def parse_output(output, data):
+    records = {(name, op): {"name": name, "operation": op, "samples": []}
+               for name, _ in data for op in OPERATIONS}
+    for line in output.splitlines():
+        row = line.split("\t")
+        if len(row) < 3 or (row[1], row[2]) not in records:
+            raise RuntimeError("malformed or unexpected benchmark row")
+        record = records[row[1], row[2]]
+        if row[0] == "R" and len(row) == 4 and "result" not in record:
+            value, operation = row[3], row[2]
+            if operation == "public":
+                valid = re.fullmatch(r"[0-9a-f]{16}|ERR:(Empty|Invalid)", value)
+            elif operation == "parse_number":
+                valid = re.fullmatch(r"NONE|[0-9]+,-?[0-9]+,(true|false),(true|false)", value)
+                if valid and value != "NONE":
+                    m, q, negative, _ = value.split(",")
+                    valid = int(m) < 10 ** 19 and run.MIN <= int(q) <= run.MAX and negative == "false"
+            elif operation == "parse_decimal_seq":
+                valid = re.fullmatch(r"[0-9]+,-?[0-9]+,(true|false),[0-9]*", value)
+                if valid:
+                    n, point, _, digits = value.split(",")
+                    valid = int(n) == len(digits) <= 768 and -(1 << 31) <= int(point) < (1 << 31)
+            else:
+                valid = re.fullmatch(r"[0-9a-f]{16},[0-9]+,-?[0-9]+", value)
+                if valid:
+                    bits, m, exponent = value.split(",")
+                    valid = (0 <= int(m) < (1 << 64) and 0 <= int(exponent) <= 2047
+                             and int(bits, 16) == int(m) | (int(exponent) << 52))
+            if not valid:
+                raise RuntimeError("malformed benchmark result")
+            record["result"] = row[3]
+            record["checksum"] = fnv(row[3])
+        elif row[0] == "S" and len(row) == 7:
+            index, iterations, ns = map(int, row[3:6])
+            if (index != len(record["samples"]) or index >= 5 or iterations <= 0
+                    or ns < 15_000_000 or row[6] != record.get("checksum")):
+                raise RuntimeError("invalid calibrated benchmark sample")
+            record["samples"].append({"iterations": iterations, "elapsed_ns": ns,
+                                      "ns_per_operation": ns / iterations})
+        else:
+            raise RuntimeError("malformed or duplicate benchmark row")
+    for record in records.values():
+        if "result" not in record or len(record["samples"]) != 5:
+            raise RuntimeError("missing benchmark regime, operation or samples")
+        samples = [s["ns_per_operation"] for s in record["samples"]]
+        record.update(median_ns=statistics.median(samples), min_ns=min(samples), max_ns=max(samples))
+    return list(records.values())
+
+
+def measure(args, selected=None):
+    data = inputs()
+    if selected is not None:
+        data = [(name, value) for name, value in data if name in selected]
+        if set(selected) != {name for name, _ in data}:
+            raise RuntimeError("unknown repeat regime")
+    cpu = affinity()
+    version = subprocess.run([str(args.rustc), "-Vv"], capture_output=True, text=True,
+                             timeout=30, check=True)
+    root = args.source.resolve()
+    evidence = {"source": str(root), "source_digest": source_digest(root),
+                "compiler": str(args.rustc), "compiler_version": version.stdout,
+                "compiler_version_stderr": version.stderr, "cpu_affinity": cpu,
+                "platform": dict(zip(("sysname", "nodename", "release", "version", "machine"), os.uname())),
+                "overflow_checks": args.overflow_checks,
+                "opt_level": 3, "debug_assertions": "on", "minimum_sample_ms": 15,
+                "samples_per_operation": 5, "utc_epoch": time.time(),
+                "inputs": [{"name": name, "length": len(value), "sha256": hashlib.sha256(value).hexdigest()}
+                           for name, value in data], "routes": []}
+    payload = "\n".join(name + "\t" + value.hex() for name, value in data) + "\n"
+    args.scratch.mkdir(parents=True, exist_ok=True)
+    with tempfile.TemporaryDirectory(prefix="performance-", dir=args.scratch) as temporary:
+        out = Path(temporary)
+        run.copy_source(root, out, Path(__file__).resolve().parent)
+        for route in ("ordinary", "optimize_for_size"):
+            executable = out / route
+            command = [str(args.rustc), "--edition=2018", str(out / "shim.rs"), "-o", str(executable),
+                       "-C", "opt-level=3", "-C", "debug-assertions=on",
+                       "-C", "overflow-checks=" + args.overflow_checks, "--cfg", "performance"]
+            if route == "optimize_for_size":
+                command.extend(["--cfg", 'feature="optimize_for_size"'])
+            build = subprocess.run(command, capture_output=True, text=True, timeout=120)
+            print(f"PERFORMANCE_COMPILE route={route} exit={build.returncode}", flush=True)
+            if build.returncode:
+                raise RuntimeError(f"benchmark compilation failed: {build.stdout}\n{build.stderr}")
+            process = subprocess.run([str(executable)], input=payload, capture_output=True,
+                                     text=True, timeout=3600)
+            print(f"PERFORMANCE_PROCESS route={route} exit={process.returncode}", flush=True)
+            if process.returncode or process.stderr:
+                raise RuntimeError(f"benchmark execution failed: {process.returncode} {process.stderr}")
+            evidence["routes"].append({"route": route, "command": command,
+                "compiler_exit": build.returncode, "compiler_stdout": build.stdout,
+                "compiler_stderr": build.stderr, "process_exit": process.returncode,
+                "process_stderr": process.stderr, "records": parse_output(process.stdout, data)})
+    if source_digest(root) != evidence["source_digest"]:
+        raise RuntimeError("source changed during benchmark")
+    return evidence
+
+
+def single(args):
+    evidence = measure(args)
+    print("PERFORMANCE_JSON " + json.dumps(evidence, separators=(",", ":")), flush=True)
+    return 0
+
+
+def paired(args):
+    all_runs, pairs = [], []
+    for round_index in range(args.rounds):
+        pair = {}
+        for label in (("baseline", "candidate") if round_index % 2 == 0 else ("candidate", "baseline")):
+            args.source = args.baseline if label == "baseline" else args.candidate
+            evidence = measure(args, args.regimes)
+            evidence.update(label=label, paired_round=round_index)
+            all_runs.append(evidence)
+            pair[label] = {(route["route"], r["name"], r["operation"]): r
+                           for route in evidence["routes"] for r in route["records"]}
+        if pair["baseline"].keys() != pair["candidate"].keys():
+            raise RuntimeError("unpaired benchmark keys")
+        pairs.append([{ "route": key[0], "name": key[1], "operation": key[2],
+                        "baseline_ns": pair["baseline"][key]["median_ns"],
+                        "candidate_ns": pair["candidate"][key]["median_ns"],
+                        "ratio": pair["candidate"][key]["median_ns"] / pair["baseline"][key]["median_ns"]}
+                      for key in pair["baseline"]])
+    comparisons = []
+    for rows in zip(*pairs, strict=True):
+        comparisons.append({"route": rows[0]["route"], "name": rows[0]["name"],
+                            "operation": rows[0]["operation"], "pairs": list(rows),
+                            "median_ratio": statistics.median(r["ratio"] for r in rows),
+                            "ratio_min": min(r["ratio"] for r in rows),
+                            "ratio_max": max(r["ratio"] for r in rows)})
+    print("PAIRED_PERFORMANCE_JSON " + json.dumps({"runs": all_runs, "comparisons": comparisons},
+                                                 separators=(",", ":")), flush=True)
+    return 0
+
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument("--baseline", type=Path, required=True)
+    parser.add_argument("--candidate", type=Path, required=True)
+    parser.add_argument("--scratch", type=Path, required=True)
+    parser.add_argument("--rustc", type=Path, required=True)
+    parser.add_argument("--overflow-checks", choices=("on", "off"), required=True)
+    parser.add_argument("--rounds", type=int, default=2)
+    parser.add_argument("--regimes", nargs="+")
+    args = parser.parse_args()
+    if args.rounds < 2:
+        raise RuntimeError("paired measurements require both alternating orders")
+    return paired(args)
+
+
+if __name__ == "__main__":
+    try:
+        sys.exit(main())
+    except (OSError, subprocess.SubprocessError, RuntimeError, ValueError, AssertionError) as error:
+        print(f"PERFORMANCE_FAILURE {type(error).__name__}: {error}", file=sys.stderr)
+        sys.exit(6)
--- /dev/null
+++ b/regression/run.py
@@ -0,0 +1,438 @@
+#!/usr/bin/env python3
+"""Offline source-copy shim, independent grammar and exact-integer test oracles."""
+import argparse
+import hashlib
+import itertools
+from pathlib import Path
+import random
+import re
+import subprocess
+import sys
+import tempfile
+
+MIN, MAX = -(1 << 63), (1 << 63) - 1
+T = 1 << 59
+A, B = 6 * T, T - 2048
+INF, SIGN = 0x7FF0000000000000, 1 << 63
+NUMERIC = re.compile(rb"(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?")
+SPECIAL = re.compile(rb"(?:inf|infinity|nan)", re.I)
+
+
+def numeric(body):
+    return NUMERIC.fullmatch(body) is not None
+
+
+def parts(body):
+    mantissa, *exponent = re.split(rb"[eE]", body)
+    explicit = int(exponent[0]) if exponent else 0
+    integer, *fraction = mantissa.split(b".")
+    frac = fraction[0] if fraction else b""
+    significant = (integer + frac).lstrip(b"0")
+    return significant, len(frac), explicit
+
+
+def accumulated_exponent(suffix):
+    """Independent unbounded-integer reference for the source pre-update fold."""
+    negative = suffix.startswith(b"-")
+    if suffix[:1] in (b"+", b"-"):
+        suffix = suffix[1:]
+    match = re.match(rb"[0-9]+", suffix)
+    if match is None:
+        return None, len(suffix)
+    magnitude = 0
+    for digit in match[0]:
+        if magnitude < T:
+            magnitude = 10 * magnitude + digit - 48
+    return -magnitude if negative else magnitude, len(suffix) - len(match[0])
+
+
+def round_ratio(n, d):
+    """Binary64 nearest-even magnitude, using only integer comparisons/division."""
+    if n == 0:
+        return 0
+    e = n.bit_length() - d.bit_length()
+    below = n < (d << e) if e >= 0 else (n << -e) < d
+    if below:
+        e -= 1
+    if e >= 1024:
+        return INF
+    shift = 1074 if e < -1022 else 52 - e
+    a, b = (n << shift, d) if shift >= 0 else (n, d << -shift)
+    q, r = divmod(a, b)
+    q += (2 * r > b) or (2 * r == b and q % 2 != 0)
+    if e < -1022:
+        return q
+    if q == 1 << 53:
+        q >>= 1
+        e += 1
+    return INF if e == 1024 else ((e + 1023) << 52) | (q - (1 << 52))
+
+
+def exact_bits(body, diagnostic=False):
+    significant, frac, explicit = parts(body)
+    if diagnostic and re.search(rb"[eE]", body):
+        explicit, _ = accumulated_exponent(re.split(rb"[eE]", body)[1])
+    if not significant:
+        return 0
+    point = len(significant) - frac + explicit
+    if point >= 310:
+        return INF
+    if point < -324:
+        return 0
+    trimmed = significant.rstrip(b"0")
+    exponent = explicit - frac + len(significant) - len(trimmed)
+    coefficient = int(trimmed)
+    n, d = (coefficient * 10 ** exponent, 1) if exponent >= 0 else (coefficient, 10 ** -exponent)
+    return round_ratio(n, d)
+
+
+def numeric_cases():
+    alphabet = [b"0", b"1", b".", b"e", b"E", b"+", b"-", b"x", b"\xff"]
+    cases = [b""]
+    for length in range(1, 5):
+        cases.extend(b"".join(c) for c in itertools.product(alphabet, repeat=length))
+    for word in ("inf", "infinity", "nan"):
+        for letters in itertools.product(*[(c.lower(), c.upper()) for c in word]):
+            for sign in ("", "+", "-"):
+                cases.append((sign + "".join(letters)).encode())
+    for text in ("\u00e9", "1\u00e9", "\u0661", "\uff11", "1\u00a0", "\u22121", "\u00001", " 1", "1\n"):
+        cases.append(text.encode())
+    rng = random.Random(0xDEC2F64)
+    for _ in range(1000):
+        cases.append(bytes(rng.choice(b"0123456789.eE+-x \x00\xff") for _ in range(rng.randrange(1, 50))))
+        integer = bytes(rng.choice(b"0123456789") for _ in range(rng.randrange(1, 80)))
+        frac = bytes(rng.choice(b"0123456789") for _ in range(rng.randrange(0, 90)))
+        body = integer + b"." + frac + b"e" + str(rng.randrange(-400, 401)).encode()
+        cases.extend([body, b"+" + body, b"-" + body])
+    cases.extend(x.encode() for x in (
+        "9007199254740993", "9007199254740995", "1.7976931348623157e308",
+        "1.7976931348623159e308", "2.2250738585072014e-308", "2.2250738585072011e-308",
+        "5e-324", "2e-324", "3e-324", "1e309", "1e-400", "12345678901234567890.00001",
+    ))
+    # Exact dyadic midpoints and their two decimal neighbors. Powers of five
+    # turn dyadic rationals into decimal literals without a floating oracle.
+    for n, k in ((1, 1075), (3, 1075), (5, 1075), ((1 << 53) - 1, 1075),
+                 ((1 << 53) + 1, 53), ((1 << 53) + 3, 53)):
+        decimal_coefficient = n * 5 ** k
+        for delta in (-1, 0, 1):
+            body = str(decimal_coefficient + delta).encode() + b"e-" + str(k).encode()
+            cases.extend([body, b"-" + body])
+    overflow_midpoint = (1 << 1024) - (1 << 970)
+    for delta in (-1, 0, 1):
+        cases.append(str(overflow_midpoint + delta).encode())
+    midpoint = b"1.00000000000000011102230246251565404236316680908203125"
+    cases.extend([midpoint, midpoint + b"0" * 1200 + b"1",
+                  b"1." + b"0" * 1200 + b"1", b"1." + b"0" * 1200])
+    for padding in (0, 769, 10000, 65536):
+        body = b"0." + b"0" * 11 + b"1000000000000000080" + b"0" * padding
+        cases.extend([body, b"-" + body])
+    for prefix in (b"1e", b"1.e+", b".1E-", b"0e", b"-0e"):
+        cases.extend([prefix + b"9" * 256, prefix + b"9" * 256 + b"x",
+                      prefix + b"9" * 256 + b".0", prefix + b"9" * 256 + b"\xff"])
+    for e in (MIN - 1, MIN, MIN + 1, MAX - 1, MAX, MAX + 1):
+        for base in (b"1", b"0.0001", b"100000000000000000000", b"0", b"-0"):
+            cases.append(base + b"e" + str(e).encode())
+    return cases
+
+
+def cutoff_cases():
+    witness = b"0." + b"0" * 65535 + b"1e655360"
+    assert len(witness) == 65545
+    cases = [("formal_wrong_one", witness, INF),
+             ("signed_formal_wrong_one", b"-" + witness, INF | SIGN),
+             ("cutoff_control_one", b"0." + b"0" * 65535 + b"1e65536", 0x3FF0000000000000),
+             ("negative_exponent_cancellation", b"1" + b"0" * 655360 + b"e-655360", 0x3FF0000000000000)]
+    for e in (65535, 65536, 65537, 655359, 655360, 655361,
+              T - 1, T, T + 1, 10 * T - 1, 10 * T, MAX, MAX + 1, MIN):
+        body = b"0." + b"0" * 65535 + b"1e" + str(e).encode()
+        # Derived decimal order: 10^(E-65536).
+        expected = INF if e - 65536 >= 310 else exact_bits(body)
+        cases.append((f"transition_{e}", body, expected))
+        negbody = b"1e-" + str(abs(e)).encode()
+        cases.append((f"negative_transition_{e}", negbody, exact_bits(negbody)))
+    for sign in (b"", b"-"):
+        for e in (b"9" * 256, b"-" + b"9" * 256):
+            cases.append((f"zero_{sign!r}_{e[:2]!r}", sign + b"0.000e" + e, SIGN if sign else 0))
+            cases.append((f"huge_{sign!r}_{e[:2]!r}", sign + b"1e" + e,
+                          (0 if e.startswith(b"-") else INF) | (SIGN if sign else 0)))
+    for junk in (b"x", b".0", b"+", b"\xff", b"\xc3\xa9"):
+        body = b"1e" + b"9" * 1024 + junk
+        cases.append((f"saturated_junk_{junk!r}", body,
+                      "ERR:Invalid" if junk != b"\xff" else "UTF8"))
+    return cases
+
+
+def count_cases():
+    cases = []
+    boundaries = [(1 << 31) - 1, 1 << 31, (1 << 31) + 1,
+                  (1 << 32) - 1, 1 << 32, (1 << 32) + 1, MAX - 128]
+    for n in boundaries:
+        cases.extend([(f"ones_{n}", n, 0, 0, "ABSENT"),
+                      (f"fractional_cancel_{n}", n - 11, n, n - 30, "ABSENT"),
+                      (f"terminal_zero_{n}", n - 11, n, n - 29, "ABSENT"),
+                      (f"negative_cancel_{n}", n, 0, 0, str(19 - n)),
+                      (f"leading_zero_cancel_{n}", 1, n, 0, str(n)),
+                      (f"trailing_zero_cancel_{n}", n, n, n - 1, str(n - 1))])
+    # The historical i64 witness lies outside A. Do not execute or allocate it.
+    cases.append(("source_max_ones", MAX, 0, 0, "ABSENT"))
+    for sig, frac, trail in ((1, 0, 0), (19, 19, 0), (MAX - 128, 0, MAX - 129),
+                             (1, MAX - 128, 0), (MAX - 150, MAX - 128, MAX - 170)):
+        base = sig - frac
+        for e in (-base, -base - 325, -base + 309,
+                  T - 1, T, T + 1, 10 * T - 1, 10 * T, 10 ** 100, -(10 ** 100)):
+            cases.append((f"bounds_{sig}_{frac}_{e}", sig, frac, trail, str(e)))
+    for point in (-(1 << 31) - 1, -(1 << 31), -(1 << 31) + 1, (1 << 31) - 1, 1 << 31,
+                  -2048, -2047, -2046, 2046, 2047, 2048):
+        cases.append((f"point_narrow_{point}", 1, 0, 0, str(point - 1)))
+    cases.extend([("zero_huge", 0, MAX - 128, 0, "9" * 100),
+                  ("saturated_suffix", 1, 0, 0, "9" * 100 + "x"),
+                  ("malformed_empty", 1, 0, 0, ""),
+                  ("malformed_sign", 1, 0, 0, "-"),
+                  ("malformed_double_sign", 1, 0, 0, "--1"),
+                  ("zero_max", 0, MAX - 128, 0, "ABSENT")])
+    for magnitude in (T - 1, T, T + 1, 10 * T - 1, 10 * T, 10 ** 100):
+        for sign in ("", "+", "-"):
+            for tail in ("", "9", "999x", "999.0", "999+", "999\u00e9"):
+                cases.append((f"fold_{sign}{magnitude}_{tail}", 1, 0, 0,
+                              sign + str(magnitude) + tail))
+    for point in (-325, -11, 0, 19, 309):
+        for sign in (-1, 1):
+            exponent = sign * (T - 1)
+            sig, frac = (T - 1 + point, 0) if sign < 0 else (1, T - point)
+            cases.append((f"large_finite_cancellation_{point}_{sign}", sig, frac, 0, str(exponent)))
+    for name, sig, frac, trail, e in cases:
+        assert 0 <= trail <= sig
+        assert max(sig, frac) + (1 if frac else 0) + (0 if e == "ABSENT" else len(e) + 1) <= MAX, name
+    return cases
+
+
+def check_counts(cases, rows):
+    assert A + (10 * T - 1) == MAX
+    assert T - B == 2048 and T - B >= 310 and B - T < -324
+    print(f"DOMAIN_ARITHMETIC A={A} B={B} T={T} overshoot_bound={10*T-1} margin=2048")
+    print("HISTORICAL_I64_WITNESS fractional_count=9223372036854120450 outside_A=true native_execution=false repaired=false")
+    for (name, sig, frac, trail, suffix), row in zip(cases, rows, strict=True):
+        if suffix == "ABSENT":
+            explicit, remaining = 0, len(suffix)
+        else:
+            explicit, remaining = accumulated_exponent(suffix.encode())
+        if explicit is None:
+            assert row == ["C", "NONE", str(remaining)], (name, row)
+            continue
+        point = sig - frac + explicit if sig else 0
+        point = min(2047, max(-2047, point))
+        expected = ["C", str(explicit), str(point), str(remaining)]
+        assert row == expected, (name, row, expected)
+        if name == "fractional_cancel_2147483648":
+            assert point == -11
+        if name == "ones_2147483648":
+            assert point >= 310, ("infinity guard", name, row)
+        if name in ("fractional_cancel_2147483648", "ones_2147483648"):
+            print(f"COUNT_WITNESS case={name} bounded_E={explicit} point={point}")
+    print(f"COUNT_BOUNDARIES_OK cases={len(cases)} arbitrary_precision_reference=true")
+
+
+def count_scan_cases():
+    cases = [b"0.000e" + b"9" * 256, b"000001.25000", b"0.00000001",
+             b"1." + b"1" * 767, b"1." + b"1" * 768,
+             b"1." + b"0" * 1200, b"1." + b"0" * 1200 + b"1"]
+    for padding in (769, 10000, 65536):
+        cases.append(b"0." + b"0" * 11 + b"1000000000000000080" + b"0" * padding)
+    return cases
+
+
+def check_preservation(cases, rows):
+    fallback_padding = 0
+    for data, row in zip(cases, rows, strict=True):
+        assert row[0] == "N" and len(row) == 8, row
+        label = repr(data[:100]) + f" length={len(data)}"
+        unsigned = numeric(data)
+        assert (row[1] != "NONE") == unsigned, ("helper grammar", label, row)
+        body = data[1:] if data[:1] in (b"+", b"-") else data
+        negative = data[:1] == b"-"
+        valid_numeric = numeric(body)
+        special = SPECIAL.fullmatch(body) is not None
+        try:
+            data.decode("utf-8")
+        except UnicodeDecodeError:
+            assert row[2] == "UTF8", (label, row)
+        else:
+            if valid_numeric:
+                expected = exact_bits(body) | (SIGN if negative else 0)
+                assert row[2] == f"{expected:016x}", ("public rounding", label, row[2], hex(expected))
+                assert int(row[2], 16) & SIGN == (SIGN if negative else 0)
+                assert int(row[2], 16) & ~SIGN <= INF
+            elif special:
+                actual = int(row[2], 16)
+                if body.lower() == b"nan":
+                    assert actual & ~SIGN > INF, ("NaN", label, row)
+                else:
+                    assert actual == INF | (SIGN if negative else 0), ("infinity", label, row)
+            else:
+                assert row[2] == ("ERR:Empty" if not data else "ERR:Invalid"), ("public grammar", label, row)
+        for sign, cell in ((False, row[3]), (True, row[4])):
+            if SPECIAL.fullmatch(data):
+                actual = int(cell, 16)
+                assert (actual & ~SIGN > INF) if data.lower() == b"nan" else (actual == INF | (SIGN if sign else 0)), (label, cell)
+            else:
+                assert cell == "NONE", ("special rejection", label, cell)
+        if not unsigned:
+            continue
+        sig, frac, e = parts(data)
+        r = max(len(sig) - 19, 0) - frac
+        bounded = accumulated_exponent(re.split(rb"[eE]", data)[1])[0] if re.search(rb"[eE]", data) else 0
+        expected_q = r + bounded
+        m, q, neg, many = row[1].split(",")
+        m, q = int(m), int(q)
+        assert neg == "false" and m < 10 ** 19, ("record bounds", label, row)
+        assert q == expected_q and (many == "true") == (len(sig) > 19), ("record scale", label, row)
+        full = int(sig or b"0")
+        unit = 10 ** max(len(sig) - 19, 0)
+        assert (m * unit <= full < (m + 1) * unit) if many == "true" else (m == full), ("diagnostic interval", label, row)
+        expected = exact_bits(data, diagnostic=True)
+        assert row[5] == f"{expected:016x}", ("direct slow rounding", label, row[5], hex(expected))
+        trimmed = sig.rstrip(b"0")
+        n, point, sticky, retained = row[6].split(",")
+        expected_point = len(sig) - frac + bounded if sig else 0
+        expected_point = min(2047, max(-2047, expected_point))
+        assert (int(n), int(point), sticky, retained) == (
+            min(len(trimmed), 768), expected_point, str(len(trimmed) > 768).lower(), trimmed[:768].decode()), ("decimal state", label, row)
+        if data.startswith(b"0." + b"0" * 11 + b"1000000000000000080") and len(data) > 768:
+            a, ap, b, bp = row[7].split(",")
+            assert many == "true" and int(ap) >= 0 and (a, ap) != (b, bp), ("forced fallback", label, row)
+            fallback_padding += 1
+    assert fallback_padding >= 3, ("padded fallback coverage", fallback_padding)
+    print(f"PRESERVATION_OK cases={len(cases)} forced_fallback_padding={fallback_padding} exact_rational_oracle=true")
+
+
+def copy_source(root, out, harness):
+    """Only internal stability attributes and test visibility change in copies."""
+    digest = hashlib.sha256()
+    files = [Path("traits.rs"), *(p.relative_to(root) for p in sorted((root / "dec2flt").glob("*.rs")))]
+    for relative in files:
+        raw = (root / relative).read_bytes()
+        digest.update(str(relative).encode() + b"\0" + raw)
+        source = raw.decode()
+        source = re.sub(r'#!\[unstable\(.*?\)\]\s*', '', source, flags=re.S)
+        if relative in (Path("dec2flt/parse.rs"), Path("dec2flt/decimal_seq.rs")):
+            source = source.replace("pub(super) fn", "pub(crate) fn")
+        if relative == Path("dec2flt/mod.rs"):
+            source = source.replace("mod common;", "pub(crate) mod common;")
+            source = source.replace("mod slow;", "pub(crate) mod slow;")
+            source += "\npub(crate) fn regression_assemble(x: common::BiasedFp) -> f64 { biased_fp_to_float::<f64>(x) }\n"
+        path = out / relative
+        path.parent.mkdir(parents=True, exist_ok=True)
+        path.write_text(source)
+    for name in ("shim.rs", "cases.rs", "bench.rs"):
+        if not (harness / name).exists():
+            continue
+        (out / name).write_bytes((harness / name).read_bytes())
+    print(f"SOURCE_ROOT={root} SOURCE_DIGEST={digest.hexdigest()}")
+
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument("--source", type=Path, required=True)
+    parser.add_argument("--scratch", type=Path, required=True)
+    parser.add_argument("--rustc", type=Path, required=True)
+    parser.add_argument("--suite", choices=("cutoff", "count-boundaries", "preservation", "performance"), required=True)
+    parser.add_argument("--overflow-checks", choices=("on", "off"), required=True)
+    parser.add_argument("--fast-path", choices=("both",), required=True)
+    args = parser.parse_args()
+    if hasattr(sys, "set_int_max_str_digits"):
+        sys.set_int_max_str_digits(0)
+    args.source = args.source.resolve()
+    args.scratch.mkdir(parents=True, exist_ok=True)
+    harness = Path(__file__).resolve().parent
+    if args.suite == "performance":
+        import performance
+        return performance.single(args)
+    if args.suite == "cutoff":
+        cases = cutoff_cases()
+        requests = ["N\t" + data.hex() for _, data, _ in cases]
+    elif args.suite == "count-boundaries":
+        cases = count_cases()
+        scans = count_scan_cases()
+        for index, data in enumerate(scans):
+            sig, frac, _ = parts(data)
+            suffix = re.split(rb"[eE]", data)[1].decode() if re.search(rb"[eE]", data) else "ABSENT"
+            cases.append((f"ordinary_scan_link_{index}", len(sig), frac,
+                          len(sig) - len(sig.rstrip(b"0")), suffix))
+        requests = [f"C\t{sig}\t{frac}\t{trail}\t{e}" for _, sig, frac, trail, e in cases]
+        requests.extend("N\t" + data.hex() for data in scans)
+    else:
+        cases = numeric_cases()
+        requests = ["N\t" + data.hex() for data in cases]
+    results = []
+    with tempfile.TemporaryDirectory(prefix="dec2flt-", dir=args.scratch) as temporary:
+        out = Path(temporary)
+        copy_source(args.source, out, harness)
+        for route in ("ordinary", "optimize_for_size"):
+            exe = out / route
+            command = [str(args.rustc), "--edition=2018", str(out / "shim.rs"), "-o", str(exe),
+                       "-C", "opt-level=1", "-C", "debug-assertions=on",
+                       "-C", "overflow-checks=" + args.overflow_checks]
+            if "fn final_decimal_point(" in (args.source / "dec2flt/decimal_seq.rs").read_text():
+                command.extend(["--cfg", "has_final_point"])
+            if route == "optimize_for_size":
+                command.extend(["--cfg", 'feature="optimize_for_size"'])
+            print("COMPILE", " ".join(command), flush=True)
+            build = subprocess.run(command, capture_output=True, text=True, timeout=120)
+            print(f"COMPILER_EXIT={build.returncode} route={route}")
+            if build.stdout:
+                print(build.stdout, end="")
+            if build.stderr:
+                print(build.stderr, end="", file=sys.stderr)
+            if build.returncode:
+                return 3
+            process = subprocess.run([str(exe)], input="\n".join(requests) + "\n",
+                                     capture_output=True, text=True, timeout=180)
+            print(f"PROCESS_EXIT={process.returncode} route={route} STDERR={process.stderr!r}")
+            if process.returncode:
+                completed = process.stdout.splitlines()
+                request = requests[len(completed)] if len(completed) < len(requests) else "AFTER_FINAL_CASE"
+                print(f"FAILED_CASE_INDEX={len(completed)} REQUEST_PREFIX={request[:180]!r}")
+                print("LAST_PROBE_ROWS", completed[-3:])
+                return 4
+            rows = [line.split("\t") for line in process.stdout.splitlines()]
+            if len(rows) != len(requests):
+                raise RuntimeError("probe output row count mismatch")
+            results.append((route, rows))
+    mismatch = False
+    for route, rows in results:
+        print(f"CHECK route={route} suite={args.suite} overflow_checks={args.overflow_checks}")
+        if args.suite == "cutoff":
+            for (name, data, expected), row in zip(cases, rows, strict=True):
+                if isinstance(expected, str):
+                    assert row[2] == expected, (name, row, expected)
+                    assert row[1] == "NONE", (name, row)
+                    print(f"CUTOFF_INVALID case={name} actual={row[2]}")
+                    continue
+                if len(row) != 8 or row[0] != "N" or not re.fullmatch(r"[0-9a-f]{16}", row[2]):
+                    raise RuntimeError(f"invalid cutoff probe output: {row}")
+                print(f"CUTOFF case={name} bytes={len(data)} actual={row[2]} expected={expected:016x} slow={row[5]}")
+                if row[2] != f"{expected:016x}":
+                    print(f"EXP_CUTOFF_MISMATCH case={name} route={route} actual={row[2]} expected={expected:016x}")
+                    mismatch = True
+                if numeric(data) and row[5] != f"{expected:016x}":
+                    if not re.fullmatch(r"[0-9a-f]{16}", row[5]):
+                        raise RuntimeError("invalid slow probe output")
+                    print(f"EXP_CUTOFF_MISMATCH case={name} route={route} direct_slow_actual={row[5]} expected={expected:016x}")
+                    mismatch = True
+        elif args.suite == "count-boundaries":
+            check_counts(cases, rows[:len(cases)])
+            check_preservation(scans, rows[len(cases):])
+            print(f"COUNT_SCAN_LINKS_OK cases={len(scans)} trimming_and_sticky=true")
+        else:
+            check_preservation(cases, rows)
+    return 42 if mismatch else 0
+
+
+if __name__ == "__main__":
+    try:
+        if not __debug__:
+            raise RuntimeError("regression assertions require Python without -O")
+        sys.exit(main())
+    except (OSError, subprocess.SubprocessError, RuntimeError, ValueError, AssertionError) as error:
+        print(f"HARNESS_FAILURE {type(error).__name__}: {error}", file=sys.stderr)
+        sys.exit(5)
--- /dev/null
+++ b/regression/shim.rs
@@ -0,0 +1,28 @@
+#![feature(float_masks, cfg_target_has_reliable_f16_f128, f16)]
+#![allow(dead_code, unused_imports, unexpected_cfgs)]
+
+pub use std::{f32, f64, fmt, ops};
+pub mod traits;
+pub mod dec2flt;
+pub mod num {
+    pub use std::num::FpCategory;
+    pub use float_parse::ParseFloatError;
+    pub mod float_parse {
+        #[derive(Debug, PartialEq, Eq)]
+        pub enum FloatErrorKind { Empty, Invalid }
+        #[derive(Debug, PartialEq, Eq)]
+        pub struct ParseFloatError { pub kind: FloatErrorKind }
+    }
+    pub mod imp {
+        pub use crate::traits::*;
+        pub use crate::dec2flt;
+    }
+}
+#[cfg(not(performance))]
+mod cases;
+#[cfg(performance)]
+mod bench;
+#[cfg(not(performance))]
+fn main() { cases::run(); }
+#[cfg(performance)]
+fn main() { bench::run(); }
