Skip to main content

Module fixed

Module fixed 

Source
Expand description

Deterministic integer analog of this crate’s floating-point error-bit arithmetic.

Every quantity elsewhere in this crate is -log2(error) as an f64 via crate::error::ErrorBits. A protocol that grades proof soundness inside a recursive verifier — a circuit or a VM with no floating-point unit — cannot reproduce that arithmetic bit-for-bit, and needs every rounding step biased toward understating security rather than overstating it. This module provides that: -log2(error) as a 16-fractional-bit fixed-point integer, computed with const fn integer operations only, rounding down on added logarithms and up on subtracted ones so the result is always a conservative lower bound on the true value.

Not wired into the rest of the crate’s f64 composition machinery — a consumer needing bit-exact recursive verification uses this module’s primitives directly rather than crate::error::ErrorBits.

Constants§

FRACTIONAL_BITS
Number of fractional bits in the fixed-point representation.
LOG2_E
log2(e) in fixed point, rounded up.
ONE
The value 1.0 in fixed point.

Functions§

bits_per_query
Returns the conjectured security contributed by a single FRI query, in fixed point.
ceil_log2
Returns log2(x) in fixed point, rounded up.
floor_log2
Returns log2(x) in fixed point, rounded down.
from_bits
Converts a whole number of bits into fixed point.
to_bits
Truncates a fixed-point quantity to whole bits, rounding down.