pub enum Count {
Integer(BigUint),
Rational(BigRational),
Log(SignedLog),
}Expand description
A count, in the domain its task produces.
It prints as the binary’s answer line prints it: an integer in decimal, a
rational as <numerator>/<denominator>, and a log-domain value as
<mantissa>e<exponent> (0 for zero).
Variants§
Integer(BigUint)
An exact integer: the model count (Mode::Mc, Mode::Compile) and
the projected model count (Mode::Pmc).
Rational(BigRational)
An exact rational: the projected weighted count (Mode::Pwmc).
Log(SignedLog)
A value in the bounded-precision log domain, its sign and the natural
log of its magnitude: the weighted count (Mode::Wmc), which stays in
that domain because exact rationals grow without bound on large
instances.
Implementations§
Source§impl Count
impl Count
Sourcepub fn to_f64(&self) -> f64
pub fn to_f64(&self) -> f64
The count as the nearest f64, for printing or plotting.
Lossy: a large integer or rational is rounded to an f64’s precision,
and a magnitude beyond f64’s range, as a log-domain value’s can be,
is infinite.
let count = tididi_cnf::Count::Rational(num_rational::BigRational::new(91.into(), 125.into()));
assert_eq!(count.to_f64(), 0.728);