pub fn exhaustive_negative_finite_primitive_floats<T: PrimitiveFloat>(
) -> ExhaustiveNegativeFinitePrimitiveFloats<T>Notable traits for ExhaustiveNegativeFinitePrimitiveFloats<T>impl<T: PrimitiveFloat> Iterator for ExhaustiveNegativeFinitePrimitiveFloats<T> type Item = T;
Expand description

Generates all finite negative primitive floats.

Positive and negative zero are both excluded.

Roughly speaking, the simplest floats are generated first. If you want to generate the floats in ascending order instead, use negative_finite_primitive_floats_increasing.

The output length is $2^M(2^E-1)-1$.

  • For f32, this is $2^{31}-2^{23}-1$, or 2139095039.
  • For f64, this is $2^{63}-2^{52}-1$, or 9218868437227405311.

Complexity per iteration

Constant time and additional memory.

Examples

use malachite_base::iterators::prefix_to_string;
use malachite_base::num::exhaustive::exhaustive_negative_finite_primitive_floats;
use malachite_base::num::float::NiceFloat;

assert_eq!(
    prefix_to_string(exhaustive_negative_finite_primitive_floats::<f32>().map(NiceFloat), 50),
    "[-1.0, -2.0, -1.5, -0.5, -1.25, -3.0, -1.75, -4.0, -1.125, -2.5, -1.375, -0.75, -1.625, \
    -3.5, -1.875, -0.25, -1.0625, -2.25, -1.1875, -0.625, -1.3125, -2.75, -1.4375, -6.0, \
    -1.5625, -3.25, -1.6875, -0.875, -1.8125, -3.75, -1.9375, -8.0, -1.03125, -2.125, \
    -1.09375, -0.5625, -1.15625, -2.375, -1.21875, -5.0, -1.28125, -2.625, -1.34375, -0.6875, \
    -1.40625, -2.875, -1.46875, -0.375, -1.53125, -3.125, ...]"
);