Numeric generators Shiro Kawai (05 Mar 2024 20:04 UTC)
Re: Numeric generators Antero Mejr (05 Mar 2024 21:42 UTC)
Re: Numeric generators Shiro Kawai (06 Mar 2024 00:28 UTC)
Re: Numeric generators Bradley Lucier (06 Mar 2024 01:39 UTC)

Re: Numeric generators Antero Mejr 05 Mar 2024 21:42 UTC

Shiro Kawai <xxxxxx@gmail.com> writes:

> 1.  Those generators are described to return "a uniformly random distribution",
> but sampling uniformly from unbounded range doesn't make sense.   The reference
> implementation limits the range with max-int.  Maybe we can mention that those
> generators sample from "implementation-dependent range"?

Sure, that wording is better.

> 2. The reference implementation uses max-int to limit the range of inexact
> numbers. It is the implementation's discretion, but you might want to test with
> extreme values (e.g. 1.0e300, or numbers in the IEEE denormalized range), if the
> tested procedure takes floating point numbers.  We may leave it to the user, but
> in that case it's even better to mention that the inexact-real-generator returns
> numbers in a certain bounded range (except the initial fixed sequence), so that
> the user need to make their own generators if they want to test wider range of
> values.

It might be better to create a new max-inexact value to cover the entire
IEEE 754 range, if the ieee-float cond-expand feature is available. If
not, max-inexact can fall back to max-int.

I will add a note to the generator section warning the user about the
implementation-defined ranges.

> 3. Is there an implementation that distinguish exact 0 and exact -0?  Is it even
> possible?

Not that I know of. R7RS-small says "Negative zero is an inexact real
value", which eliminates the possibility of an exact -0 I think.