English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Ints and overflow...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-07-13 (19:22)
From: Krishnaswami, Neel <neelk@c...>
Subject: [Caml-list] Ints and overflow...

I need a really fast pseudo-rng (quality is second to speed) and 
decided to implement a linear congruential generator, since they
are really simple and there are literally reams of papers describing
good parameter choices.

However, this has led me directly into the zone of integer overflow.
Basically, I don't understand what I can expect to be portable, and
I really don't understand what OCaml does -- what is the tagging 
scheme, and how does that affect the overflow results I can expect?

For example: Is the integer tag 0 or 1? Does it vary by platform? Can 
the results vary by how Caml chooses to optimize adds? Does Caml 
promise anything at all about the results of an overflowing integer
add? Each of these seems quite simple but the sum total leaves me 
quite lost.

I would be very grateful if someone could relieve my confusion.

Neel Krishnaswami
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr