rand(-1) throws MemoryError with no (useful) message #1344

Closed
pao opened this Issue Oct 7, 2012 · 1 comment

Comments

Projects
None yet
3 participants
@pao
Member

pao commented Oct 7, 2012

julia> rand(-1)
MemoryError()
 in rand at rng.jl:148
  1. I would have expected this to be a different type of error. Do we have a list of standard exceptions and what they mean?
  2. The error message tells me the name of the exception, and I do get a backtrace, but provides no indication as to what I did wrong. Note that randi() uses a first argument differently; while we're MATLAB compatible this is another one where MATLAB is kind of confusing.

I'd look to see what MATLAB does here except I'm not at work. Preemptively assigning to @ViralBShah because he's been doing the RNG refactoring.

@ghost ghost assigned ViralBShah Oct 7, 2012

@JeffBezanson

This comment has been minimized.

Show comment Hide comment
@JeffBezanson

JeffBezanson Oct 9, 2012

Owner

Matlab seems to treat negative sizes as zero. A domain error would make more sense.

Owner

JeffBezanson commented Oct 9, 2012

Matlab seems to treat negative sizes as zero. A domain error would make more sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment