RANDOM error message

Bug #598986 reported by Stas Boukarev
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
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)).

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

Revision history for this message
Stas Boukarev (stassats) wrote :

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

Stas Boukarev (stassats)
tags: added: review
Revision history for this message
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  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.