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
Int64 overflow checks
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-01 (02:50)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Int64 overflow checks
On Monday 30 April 2007 18:24, Raj B wrote:
> Hi
> I am writing an implementation of the Python programming language in
> OCaml and ran into an interesting issue.
> Python allows the programmer to implicitly perform arbitrary-sized
> integer operations by switching internally between its 'int' and
> 'long' types. (which seems to translate to OCaml's int64 and BigInt).
> I found an OCaml library on a mailing list which checks for overflow
> in 'normal' 32-bit integer operations. How can I check for overflows
> in int64 operations so I can switch to big-int if that happens?

Sounds like a premature optimization. Just use Big_int for everything to start 

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
The F#.NET Journal