Comment 1 for bug 598986

Revision history for this message
Christophe Rhodes (csr21-cantab) wrote : Re: [Bug 598986] [NEW] RANDOM error message

Stas Boukarev <email address hidden> writes:

> Public bug reported:
>
> RANDOM has an error message in its code: http://git.boinkor.net/gitweb/sbcl.git?a=blob;f=src/code/target-random.lisp;h=2f7d1a623c68cb2270e2602b15fca5c67f2a5345;hb=HEAD#l373
> But it's never reached because RANDOM is proclaimed as
>
> (defknown random ((or (float (0.0)) (integer 1)) &optional random-state)
> (or (float 0.0) (integer 0)) ())
>
> and you get not a very helpful error:
> The value -1 is not of type
> (OR (SINGLE-FLOAT (0.0)) (DOUBLE-FLOAT (0.0d0)) (INTEGER 1)).

I think that there might be an explicit-check defknown flag; I'm not
sure that its semantics are exactly right, but that's one thing to
check. Failing that, a different approach might be to get that
complicated type to unparse to (REAL (0)), which is at least relatively
simple.

Christophe