pub fn special_random_negative_primitive_floats<T: PrimitiveFloat>(
    seed: Seed,
    mean_sci_exponent_numerator: u64,
    mean_sci_exponent_denominator: u64,
    mean_precision_numerator: u64,
    mean_precision_denominator: u64,
    mean_special_p_numerator: u64,
    mean_special_p_denominator: u64
) -> WithSpecialValue<SpecialRandomNegativeFiniteFloats<T>>Notable traits for WithSpecialValue<I>impl<I: Iterator> Iterator for WithSpecialValue<I> where
    I::Item: Clone
type Item = I::Item;
Expand description

Generates negative primitive floats.

Simpler floats (those with a lower absolute sci-exponent or precision) are more likely to be chosen. You can specify the numerator and denominator of the probability that negative infinity will be generated. You can also specify the mean absolute sci-exponent and precision by passing the numerators and denominators of their means of the finite floats.

But note that the specified means are only approximate, since the distributions we are sampling are truncated geometric, and their exact means are somewhat annoying to deal with. The practical implications are that

  • The actual means are slightly lower than the specified means.
  • However, increasing the specified means increases the actual means, so this still works as a mechanism for controlling the sci-exponent and precision.
  • The specified sci-exponent mean must be greater than 0 and the precision mean greater than 2, but they may be as high as you like.

Negative zero is generated; positive zero is not. NaN is not generated either.

The output length is infinite.

Expected complexity per iteration

Constant time and additional memory.

Examples

use malachite_base::iterators::prefix_to_string;
use malachite_base::num::basic::floats::PrimitiveFloat;
use malachite_base::num::float::NiceFloat;
use malachite_base::num::random::special_random_negative_primitive_floats;
use malachite_base::random::EXAMPLE_SEED;

assert_eq!(
    prefix_to_string(
        special_random_negative_primitive_floats::<f32>(EXAMPLE_SEED, 10, 1, 10, 1, 1, 10)
                .map(NiceFloat),
        20
    ),
    "[-0.6328125, -9.536743e-7, -0.013671875, -Infinity, -0.6875, -70208.0, -0.01550293, \
    -0.028625488, -3.3095703, -5.775879, -0.000034958124, -0.4375, -31678.0, -Infinity, \
    -49152.0, -1.0, -49.885254, -Infinity, -0.40625, -0.0015869141, ...]"
);