Primary evidence for the binary64 boundary
==========================================
Scope and identities
--------------------
This record concerns the frozen x86_64-unknown-linux-gnu extraction, the
adapted Rust crate retained in this repository, and the installed toolchain
named by modeling-input/SETUP.md. The probe source is retained at
reference/model-evidence/binary64-probe.rs; no scratch source is required to
reproduce it.
Toolchain executable:
/home/leanagent/.rustup/toolchains/nightly-2026-06-01-x86_64-unknown-linux-gnu/bin/rustc
Target:
x86_64-unknown-linux-gnu
rustc executable SHA-256:
162c2a2d2d89b94e5bc2ec6b179a49d12a7ea1527db9ff1df20b5d09c432924b
Probe source SHA-256:
68e70be70faa44c2781990457f09ef5fc7815e120fda0a468eaa85f9b634ad7e
Compiled probe SHA-256:
f49942b5558d9073d879c724067a771cddd07f1543efc6d1d8ee691f8e25a322
Frozen generated.lean SHA-256:
45b5027c42f9bb25bf22d3573fdb0f93784cf93d2a7b92ef1a7687c8f66c25a9
Frozen modeling-input/manifest.json SHA-256:
a1fadc68519dfb08ec739d1f2e5d7ff558f696a3145a25bbb2934f2bf4aa04d2
Approved Binary64ModelDefault.lean SHA-256 at the time of this record:
03ae48fb631e6242bd21bf95d0481b66acae05f8cab343c7ab279b3c116538a3
Exact reproduction commands
---------------------------
Run from the repository root:
R=/home/leanagent/.rustup/toolchains/nightly-2026-06-01-x86_64-unknown-linux-gnu/bin/rustc
P=reference/model-evidence/binary64-probe.rs
B=.trellis/scratch/binary64-probe
"$R" --version --verbose
sha256sum "$R"
sha256sum "$P"
"$R" --target x86_64-unknown-linux-gnu -C opt-level=0 "$P" -o "$B"
sha256sum "$B"
"$B"
Raw output
----------
rustc 1.98.0-nightly (14210df0e 2026-05-31)
binary: rustc
commit-hash: 14210df0e27ccd7d9e6a05b8085cbd438e4bbc65
commit-date: 2026-05-31
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6
rustc_sha256=162c2a2d2d89b94e5bc2ec6b179a49d12a7ea1527db9ff1df20b5d09c432924b
probe_sha256=68e70be70faa44c2781990457f09ef5fc7815e120fda0a468eaa85f9b634ad7e
binary_sha256=f49942b5558d9073d879c724067a771cddd07f1543efc6d1d8ee691f8e25a322
target_arch=x86_64
mantissa_digits=53
exponent_mask=7ff0000000000000
mantissa_mask=000fffffffffffff
nan=7ff8000000000000
infinity=7ff0000000000000
neg_infinity=fff0000000000000
nan_category=Nan
infinity_category=Infinite
zero_category=Zero
subnormal_category=Subnormal
normal_category=Normal
from_bits_to_bits=7ff0000000000001
neg_payload_nan=fff0000000000001
neg_zero=8000000000000000
subnormal_tie_to_even_zero=0000000000000000
subnormal_tie_to_even_two=0000000000000002
normal_division=3fb999999999999a
mul_negative_zero=8000000000000000
div_negative_zero=8000000000000000
div_negative_infinity=fff0000000000000
mul_overflow=7ff0000000000000
mul_zero_infinity_is_nan=true
div_zero_zero_is_nan=true
mul_nan_is_nan=true
cast_2_pow_53=4340000000000000
cast_2_pow_53_plus_1=4340000000000000
Pinned Rust library sources
---------------------------
The installed sources below belong to the same named toolchain. Their
SHA-256 identities are:
core/src/primitive_docs.rs
c4b8627dd67d5dac8f383f383a9e7ff1229ea43e7599610fc61988694cf0f3e5
core/src/num/f64.rs
84540a6a59e347c63caabe12cf895ba1239c76a50682471567007138fac1c618
core/src/clone.rs
23f9cfc80347fde6b8457d46fbf7a2b8d9f34c8c58601b0b6f714ca2f6d1976b
The exact relevant text of core/src/primitive_docs.rs is:
#[rustc_doc_primitive = "f64"]
#[doc(alias = "double")]
/// A 64-bit floating-point type (specifically, the "binary64" type defined in IEEE 754-2008).
///
/// This type is very similar to [`prim@f32`], but has increased precision by using twice as many
/// bits. Please see [the documentation for `f32`](prim@f32) or [Wikipedia on double-precision
/// values][wikipedia] for more information.
The referenced primitive-f32 documentation supplies the common primitive
floating-point operation rules quoted next:
/// - −0.0: IEEE 754 floating-point numbers have a bit that indicates their sign, so −0.0 is a
/// possible value. For comparison −0.0 = +0.0, but floating-point operations can carry
/// the sign bit through arithmetic operations. This means −0.0 × +0.0 produces −0.0 and
/// a negative number rounded to a value smaller than a float can represent also produces −0.0.
/// - [∞](#associatedconstant.INFINITY) and
/// [−∞](#associatedconstant.NEG_INFINITY): these result from calculations
/// like `1.0 / 0.0`.
///
/// When a primitive operation (addition, subtraction, multiplication, or
/// division) is performed on this type, the result is rounded according to the
/// roundTiesToEven direction defined in IEEE 754-2008. That means:
///
/// - The result is the representable value closest to the true value, if there
/// is a unique closest representable value.
/// - If the true value is exactly half-way between two representable values,
/// the result is the one with an even least-significant binary digit.
/// - If the true value's magnitude is ≥ `f32::MAX` + 2(`f32::MAX_EXP` −
/// `f32::MANTISSA_DIGITS` − 1), the result is ∞ or −∞ (preserving the
/// true value's sign).
The same file explicitly separates arithmetic NaN choice from exact bitwise
operations; its exact relevant text is:
/// The rules for NaN values differ between *arithmetic* and *non-arithmetic* (or "bitwise")
/// operations. The non-arithmetic operations are unary `-`, `abs`, `copysign`, `signum`,
/// `{to,from}_bits`, `{to,from}_{be,le,ne}_bytes` and `is_sign_{positive,negative}`. These
/// operations are guaranteed to exactly preserve the bit pattern of their input except for possibly
/// changing the sign bit.
///
/// The following rules apply when a NaN value is returned from an arithmetic operation:
/// - The result has a non-deterministic sign.
/// - The quiet bit and payload are non-deterministically chosen from
/// the following set of options:
///
/// - **Preferred NaN**: The quiet bit is set and the payload is all-zero.
/// - **Quieting NaN propagation**: The quiet bit is set and the payload is copied from any input
/// operand that is a NaN. If the inputs and outputs do not have the same payload size (i.e., for
/// `as` casts), then
/// - If the output is smaller than the input, low-order bits of the payload get dropped.
/// - If the output is larger than the input, the payload gets filled up with 0s in the low-order
/// bits.
/// - **Unchanged NaN propagation**: The quiet bit and payload are copied from any input operand
/// that is a NaN. If the inputs and outputs do not have the same size (i.e., for `as` casts), the
/// same rules as for "quieting NaN propagation" apply, with one caveat: if the output is smaller
/// than the input, dropping the low-order bits may result in a payload of 0; a payload of 0 is not
/// possible with a signaling NaN (the all-0 significand encodes an infinity) so unchanged NaN
/// propagation cannot occur with some inputs.
/// - **Target-specific NaN**: The quiet bit is set and the payload is picked from a target-specific
/// set of "extra" possible NaN payloads. The set can depend on the input operand values.
/// See the table below for the concrete NaNs this set contains on various targets.
///
/// | `target_arch` | Extra payloads possible on this platform |
/// |---------------|------------------------------------------|
/// | `aarch64`, `arm`, `arm64ec`, `loongarch64`, `powerpc` (except when `target_abi = "spe"`), `powerpc64`, `riscv32`, `riscv64`, `s390x`, `x86`, `x86_64` | None |
Thus the model's preferred quiet NaN is one permitted result whenever
multiplication or division returns NaN. This does not claim that arbitrary
Rust arithmetic NaNs have those exact bits. By contrast, unary negation and
bit conversion must preserve all non-sign bits exactly, including for every
NaN payload.
The exact relevant declarations in core/src/num/f64.rs are:
pub const MANTISSA_DIGITS: u32 = 53;
pub const NAN: f64 = 0.0_f64 / 0.0_f64;
pub const INFINITY: f64 = 1.0_f64 / 0.0_f64;
pub const NEG_INFINITY: f64 = -1.0_f64 / 0.0_f64;
pub const SIGN_MASK: u64 = 0x8000_0000_0000_0000;
pub const EXPONENT_MASK: u64 = 0x7ff0_0000_0000_0000;
pub const MANTISSA_MASK: u64 = 0x000f_ffff_ffff_ffff;
pub const fn classify(self) -> FpCategory {
// We used to have complicated logic here that avoids the simple bit-based tests to work
// around buggy codegen for x87 targets (see
// https://github.com/rust-lang/rust/issues/114479). However, some LLVM versions later, none
// of our tests is able to find any difference between the complicated and the naive
// version, so now we are back to the naive version.
let b = self.to_bits();
match (b & Self::MANTISSA_MASK, b & Self::EXPONENT_MASK) {
(0, Self::EXPONENT_MASK) => FpCategory::Infinite,
(_, Self::EXPONENT_MASK) => FpCategory::Nan,
(0, 0) => FpCategory::Zero,
(_, 0) => FpCategory::Subnormal,
_ => FpCategory::Normal,
}
}
pub const fn to_bits(self) -> u64 {
// SAFETY: `u64` is a plain old datatype so we can always transmute to it.
unsafe { mem::transmute(self) }
}
pub const fn from_bits(v: u64) -> Self {
// It turns out the safety issues with sNaN were overblown! Hooray!
// SAFETY: `u64` is a plain old datatype so we can always transmute from it.
unsafe { mem::transmute(v) }
}
The exact scalar clone body in core/src/clone.rs is:
impl const Clone for $t {
#[inline(always)]
fn clone(&self) -> Self {
*self
}
}
Frozen adapted source
---------------------
The relevant retained source file hashes are:
crate/traits.rs
9013270fb846edcb0bdf2abd0353f575fdd727974cba9e89bdab8bb4c2b4f0bf
crate/dec2flt/mod.rs
ecadc1d7df05dfda85fcf99fc45da7e40cb36aa9736d12d1b3a75f60f532907d
crate/dec2flt/parse.rs
50d95265e5b1af43ee4f0033c9ff8d1b8dfd62d766ab14668ceec19955adba1f
crate/dec2flt/decimal.rs
633658be803b7369b18feb098a8aa1b5f714a933d3b79ecbc4899a1b05f35beb
crate/dec2flt/lemire.rs
fee1397d264fe4c5af5fa27efae0af7c5ad453be7cff8389abc24b9b252aead1
crate/dec2flt/slow.rs
93ba8f521d4c3c73dfbcd4c76e0e1cf1fff7fa400cb4cd559218e249a7f62485
The dispatcher excerpts below are reproduced from the identified file by
running these commands from the repository root:
sha256sum crate/dec2flt/mod.rs
sed -n '354,403p' crate/dec2flt/mod.rs
sed -n '405,422p' crate/dec2flt/mod.rs
sed -n '465,475p' crate/dec2flt/mod.rs
sed -n '506,523p' crate/dec2flt/mod.rs
Exact constant and bit-conversion excerpt from crate/traits.rs:
impl Float for f64 {
type Int = u64;
const INFINITY: Self = Self::INFINITY;
const NEG_INFINITY: Self = Self::NEG_INFINITY;
const NAN: Self = Self::NAN;
// Bit-identical to the upstream `-f64::NAN`, without the unsupported
// compile-time float negation.
const NEG_NAN: Self = f64::from_bits(0xFFF8_0000_0000_0000);
const BITS: u32 = 64;
const SIG_TOTAL_BITS: u32 = Self::MANTISSA_DIGITS;
const EXP_MASK: Self::Int = Self::EXPONENT_MASK;
const SIG_MASK: Self::Int = Self::MANTISSA_MASK;
fn to_bits(self) -> Self::Int {
self.to_bits()
}
fn classify(self) -> FpCategory {
self.classify()
}
}
impl FloatExt for f64 {
#[inline]
fn from_u64_bits(v: u64) -> Self {
f64::from_bits(v)
}
Exact derived-constant defaults from crate/traits.rs:
/// The number of bits in the significand, *excluding* the hidden bit.
const SIG_BITS: u32 = Self::SIG_TOTAL_BITS - 1;
/// Number of bits in the exponent.
const EXP_BITS: u32 = Self::BITS - Self::SIG_BITS - 1;
/// The saturated (maximum bitpattern) value of the exponent, i.e. the infinite
/// representation.
///
/// This shifted fully right, use `EXP_MASK` for the shifted value.
const EXP_SAT: u32 = (1 << Self::EXP_BITS) - 1;
/// Signed version of `EXP_SAT` since we convert a lot.
const INFINITE_POWER: i32 = Self::EXP_SAT as i32;
/// The exponent bias value. This is also the maximum value of the exponent.
const EXP_BIAS: u32 = Self::EXP_SAT >> 1;
/// Minimum exponent value of normal values.
const EXP_MIN: i32 = -(Self::EXP_BIAS as i32 - 1);
Together with the f64-instance lines `BITS = 64` and
`SIG_TOTAL_BITS = Self::MANTISSA_DIGITS` in the preceding excerpt, these
defaults derive SIG_BITS, EXP_MIN, and INFINITE_POWER from the primitive
mantissa-digit constant rather than introducing independent parameters.
Exact asserted-conversion excerpt from crate/dec2flt/mod.rs:
#[inline]
// Aeneas cannot translate the source `u64 as f64` primitive conversion, so
// `charon::opaque` makes this entire asserted conversion external: both the
// unchanged `debug_assert!` and the unchanged cast below are in the opaque
// body. The callers, their fast-path guards, and their surrounding
// computation remain mechanically visible. A corresponding model binding
// must fail the assertion above `MAX_MANTISSA_FAST_PATH` and return the
// exact binary64 conversion at or below that bound.
#[charon::opaque]
fn from_u64(v: u64) -> Self {
debug_assert!(v <= Self::MAX_MANTISSA_FAST_PATH);
v as _
}
Here MAX_MANTISSA_FAST_PATH is the retained default 1 << 53. The attribute is
attached to the function item, so the generated external stands for the whole
method, not merely the cast. In the enabled-debug configuration the source
succeeds only when v <= 2^53; above it the assertion fails before the cast. On
the successful branch every integer is exactly representable, so the source
cast and the model rounder return the same word.
Exact power-table and assembly excerpts from crate/dec2flt/mod.rs:
/// Maximum mantissa for the fast-path (`1 << 53` for f64).
const MAX_MANTISSA_FAST_PATH: u64 = 1 << Self::SIG_TOTAL_BITS;
const MAX_EXPONENT_FAST_PATH: i64 = 22;
const MIN_EXPONENT_FAST_PATH: i64 = -Self::MAX_EXPONENT_FAST_PATH;
const MAX_EXPONENT_DISGUISED_FAST_PATH: i64 = 37;
fn pow10_fast_path(exponent: usize) -> Self {
// These bit patterns are exactly the source table's rounded binary64
// literals. The match is the same masked lookup; it merely keeps float
// constants out of Aeneas's unsupported constant interpreter.
match exponent & 31 {
0 => f64::from_bits(0x3FF0_0000_0000_0000),
1 => f64::from_bits(0x4024_0000_0000_0000),
2 => f64::from_bits(0x4059_0000_0000_0000),
3 => f64::from_bits(0x408F_4000_0000_0000),
4 => f64::from_bits(0x40C3_8800_0000_0000),
5 => f64::from_bits(0x40F8_6A00_0000_0000),
6 => f64::from_bits(0x412E_8480_0000_0000),
7 => f64::from_bits(0x4163_12D0_0000_0000),
8 => f64::from_bits(0x4197_D784_0000_0000),
9 => f64::from_bits(0x41CD_CD65_0000_0000),
10 => f64::from_bits(0x4202_A05F_2000_0000),
11 => f64::from_bits(0x4237_4876_E800_0000),
12 => f64::from_bits(0x426D_1A94_A200_0000),
13 => f64::from_bits(0x42A2_309C_E540_0000),
14 => f64::from_bits(0x42D6_BCC4_1E90_0000),
15 => f64::from_bits(0x430C_6BF5_2634_0000),
16 => f64::from_bits(0x4341_C379_37E0_8000),
17 => f64::from_bits(0x4376_3457_85D8_A000),
18 => f64::from_bits(0x43AB_C16D_674E_C800),
19 => f64::from_bits(0x43E1_58E4_6091_3D00),
20 => f64::from_bits(0x4415_AF1D_78B5_8C40),
21 => f64::from_bits(0x444B_1AE4_D6E2_EF50),
22 => f64::from_bits(0x4480_F0CF_064D_D592),
_ => f64::from_bits(0),
}
}
fn biased_fp_to_float(x: BiasedFp) -> F {
let mut word = x.m;
word |= (x.p_biased as u64) << F::SIG_BITS;
F::from_u64_bits(word)
}
Exact native-call excerpt from crate/dec2flt/decimal.rs:
fn can_use_fast_path(&self) -> bool {
F::MIN_EXPONENT_FAST_PATH <= self.exponent
&& self.exponent <= F::MAX_EXPONENT_DISGUISED_FAST_PATH
&& self.mantissa <= F::MAX_MANTISSA_FAST_PATH
&& !self.many_digits
}
if !self.can_use_fast_path::() {
return None;
}
let value = if self.exponent <= F::MAX_EXPONENT_FAST_PATH {
// normal fast path
let value = F::from_u64(self.mantissa);
if self.exponent < 0 {
// Explicit trait calls preserve Rust arithmetic and resolve
// the generic output type that Charon leaves ambiguous.
core::ops::Div::div(value, F::pow10_fast_path((-self.exponent) as _))
} else {
core::ops::Mul::mul(value, F::pow10_fast_path(self.exponent as _))
}
} else {
// disguised fast path
let shift = self.exponent - F::MAX_EXPONENT_FAST_PATH;
let mantissa = self.mantissa.checked_mul(INT_POW10[shift as usize])?;
if mantissa > F::MAX_MANTISSA_FAST_PATH {
return None;
}
core::ops::Mul::mul(
F::from_u64(mantissa),
F::pow10_fast_path(F::MAX_EXPONENT_FAST_PATH as _),
)
};
if self.negative {
Some(core::ops::Neg::neg(value))
} else {
Some(value)
}
The preceding can_use_fast_path body, together with
MAX_MANTISSA_FAST_PATH = 1 << SIG_TOTAL_BITS and SIG_TOTAL_BITS = 53 for f64,
requires the exponent to lie between -22 and 37, the input mantissa to be at
most 2^53, and many_digits to be false. Consequently an ordinary arithmetic
call has a from_u64 operand in 0..=2^53. In its negative-exponent arm,
`-self.exponent` lies in 1..=22; in its nonnegative arm, `self.exponent` lies
in 0..=22. The disguised branch checks its multiplied mantissa against 2^53
before from_u64 and uses table index 22. The paired statement
Binary64NativeCallDomain does not assert this source reachability. It says
conditionally that a from_u64 argument at most 2^53 succeeds with a finite,
non-NaN word and that a table index at most 22 succeeds with a positive,
nonzero, finite, non-NaN word. Applying that conditional statement to the
guards just derived establishes those properties for the actual ordinary and
disguised calls, and in particular establishes that every executed divisor is
nonzero.
Exact special-value excerpt from crate/dec2flt/parse.rs:
let float = match (register, len) {
(INF_3, 3) => F::INFINITY,
(INF_8, 8) => F::INFINITY,
(NAN, 3) => F::NAN,
_ => return None,
};
if negative { Some(-float) } else { Some(float) }
Thus the executed special route is INFINITY or NAN followed by conditional
negation; it does not select NEG_INFINITY or NEG_NAN directly.
The number helper has the exact source body
pub fn parse_number(s: &[u8]) -> Option {
if let Some((float, rest)) = parse_partial_number(s) {
if rest == s.len() {
return Some(float);
}
}
None
}
It returns only the Decimal produced by parse_partial_number; there is no
float type parameter or float operation at this boundary.
Exact dispatcher excerpts from crate/dec2flt/mod.rs
---------------------------------------------------
The entry of `dec2flt_with_trace` strips at most one leading sign, rejects
empty and sign-only inputs, calls `parse_number` on the unsigned body, and
calls `parse_inf_nan` only when `parse_number` returns `None`:
/// Run the actual dispatcher while retaining its approved internal observations.
pub fn dec2flt_with_trace<
'a,
F: Lemire
+ core::ops::Div