pub fn positive_finite_primitive_floats_increasing<T: PrimitiveFloat>(
) -> PrimitiveFloatIncreasingRange<T> 
Expand description

Generates all finite positive primitive floats, in ascending order.

Positive and negative zero are both excluded.

MIN_POSITIVE_SUBNORMAL is generated first and MAX_FINITE is generated last. The returned iterator is double-ended, so it may be reversed.

Let $\varphi$ be to_ordered_representation:

The output is $(\varphi^{-1}(k))_{k=2^M(2^E-1)+2}^{2^{M+1}(2^E-1)}$.

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::positive_finite_primitive_floats_increasing;
use malachite_base::num::float::NiceFloat;

assert_eq!(
    prefix_to_string(positive_finite_primitive_floats_increasing::<f32>().map(NiceFloat), 20),
    "[1.0e-45, 3.0e-45, 4.0e-45, 6.0e-45, 7.0e-45, 8.0e-45, 1.0e-44, 1.1e-44, 1.3e-44, \
    1.4e-44, 1.5e-44, 1.7e-44, 1.8e-44, 2.0e-44, 2.1e-44, 2.2e-44, 2.4e-44, 2.5e-44, 2.7e-44, \
    2.8e-44, ...]"
);
assert_eq!(
    prefix_to_string(
        positive_finite_primitive_floats_increasing::<f32>().rev().map(NiceFloat),
        20
    ),
    "[3.4028235e38, 3.4028233e38, 3.402823e38, 3.4028229e38, 3.4028227e38, 3.4028225e38, \
    3.4028222e38, 3.402822e38, 3.4028218e38, 3.4028216e38, 3.4028214e38, 3.4028212e38, \
    3.402821e38, 3.4028208e38, 3.4028206e38, 3.4028204e38, 3.4028202e38, 3.40282e38, \
    3.4028198e38, 3.4028196e38, ...]"
);