chickadee » srfi-252 » inexact-real-generator

inexact-real-generatorprocedure

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

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

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

    (define inexact-real-gen (inexact-real-generator))

    (inexact-real-gen) ; => 0.0