chickadee » srfi-252 » inexact-number-generator

inexact-number-generatorprocedure

Create an infinite generator that returns objects that fulfill the inexact? predicate. The generator should return the sequence

    0.0 -0.0 0.5 -0.5 1.0 -1.0
    0.0+1.0i 0.0-1.0i -0.0+1.0i -0.0-1.0i
    0.5+0.5i 0.5-0.5i -0.5+0.5i -0.5-0.5i
    1.0+1.0i 1.0-1.0i -1.0+1.0i -1.0-1.0i
    +inf.0+inf.0i +inf.0-inf.0i -inf.0+inf.0i -inf.0-inf.0i
    +nan.0+nan.0i
    +inf.0 -inf.0 +nan.0

first, then a uniformly random distribution of inexact numbers. Elements of the above sequence may be omitted if they are not distinguished in the implementation.

    (define inexact-gen (inexact-number-generator))

    (inexact-gen) ; => 0.0