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

Generates all finite primitive floats, in ascending order.

Positive and negative zero are both included. Negative zero comes first.

-MAX_FINITE 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=1}^{2^{M+1}(2^E-1)}$.

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

  • For f32, this is $2^{32}-2^{24}$, or 4278190080.
  • For f64, this is $2^{64}-2^{53}$, or 18437736874454810624.

§Complexity per iteration

Constant time and additional memory.

§Examples

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

assert_eq!(
    prefix_to_string(finite_primitive_floats_increasing::<f32>().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, ...]",
);
assert_eq!(
    prefix_to_string(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, ...]"
);