Steel Bank Common Lisp

RANDOM error message

Reported by Stas Boukarev on 2010-06-27
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

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)).

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

Stas Boukarev (stassats) wrote :

explicit-check looks like the right thing, I attached a patch.

Stas Boukarev (stassats) on 2010-08-16
tags: added: review
Nikodemus Siivola (nikodemus) wrote :

Thank you.

In SBCL 1.0.42.16.

Changed in sbcl:
status: New → Fix Committed
tags: removed: review
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers