* Bug? Random.int max_int on AMD64 fails
@ 2005-06-01 8:14 Christian Lindig
2005-06-01 8:58 ` [Caml-list] " Richard Jones
0 siblings, 1 reply; 3+ messages in thread
From: Christian Lindig @ 2005-06-01 8:14 UTC (permalink / raw)
To: Caml List; +Cc: caml-bugs
On an AMD64, OCaml 3.08.03 raises an exception for the following code:
> src > uname -a
> Linux operator 2.6.10 #1 SMP Wed Feb 16 17:00:41 CET 2005 x86_64
> GNU/Linux
>
> src > ocaml
> Objective Caml version 3.08.3
>
> # Random.int max_int;;
> Exception: Invalid_argument "Random.int".
> #
The same code poses no problem on a 32-bit machine, like the PowerPC:
> : lindig; ocaml
> Objective Caml version 3.08.0
>
> # Random.int max_int;;
> - : int = 819618234
> # ^D
> : lindig; uname -a
> Darwin jonagold.cs.uni-sb.de 7.8.0 Darwin Kernel Version 7.8.0: Wed
> Dec 22 14:26:17 PST 2004; root:xnu/xnu-517.11.1.obj~1/RELEASE_PPC
> Power Macintosh powerpc
-- Christian
--
http://www.st.cs.uni-sb.de/~lindig/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Bug? Random.int max_int on AMD64 fails
2005-06-01 8:14 Bug? Random.int max_int on AMD64 fails Christian Lindig
@ 2005-06-01 8:58 ` Richard Jones
2005-06-01 12:27 ` Jean-Christophe Filliatre
0 siblings, 1 reply; 3+ messages in thread
From: Richard Jones @ 2005-06-01 8:58 UTC (permalink / raw)
To: Christian Lindig; +Cc: Caml List, caml-bugs
On Wed, Jun 01, 2005 at 10:14:01AM +0200, Christian Lindig wrote:
> ># Random.int max_int;;
> >Exception: Invalid_argument "Random.int".
> >#
The documentation states:
(** [Random.int bound] returns a random integer between 0 (inclusive)
and [bound] (exclusive). [bound] must be more than 0 and less
than 2{^30}. *)
On 64 bit machines, max_int is 2^62 or thereabouts.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Bug? Random.int max_int on AMD64 fails
2005-06-01 8:58 ` [Caml-list] " Richard Jones
@ 2005-06-01 12:27 ` Jean-Christophe Filliatre
0 siblings, 0 replies; 3+ messages in thread
From: Jean-Christophe Filliatre @ 2005-06-01 12:27 UTC (permalink / raw)
To: Richard Jones; +Cc: Christian Lindig, Caml List, caml-bugs
Richard Jones writes:
> On Wed, Jun 01, 2005 at 10:14:01AM +0200, Christian Lindig wrote:
> > ># Random.int max_int;;
> > >Exception: Invalid_argument "Random.int".
> > >#
>
> The documentation states:
>
> (** [Random.int bound] returns a random integer between 0 (inclusive)
> and [bound] (exclusive). [bound] must be more than 0 and less
> than 2{^30}. *)
>
> On 64 bit machines, max_int is 2^62 or thereabouts.
... and I'll add to this answer that you have Random.int64 available.
--
Jean-Christophe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-06-01 12:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-01 8:14 Bug? Random.int max_int on AMD64 fails Christian Lindig
2005-06-01 8:58 ` [Caml-list] " Richard Jones
2005-06-01 12:27 ` Jean-Christophe Filliatre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox