Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] Runtime overflow and what to do
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-10-10 (22:17)
From: Scott J, <jscott@p...>
Subject: Re: [Caml-list] Runtime overflow and what to do

So it is not easy, perhaps even impossible if the processor doesn't set a
flag .

e.g. fact n begins first with a lis of negative numbers (after overflow)
then comes again a list with positive numbers and then it remains = 0

  ----- Original Message -----
  From: Xavier Leroy
  To: Sven LUTHER
  Cc: Luc Maranget ; Scott J, ;
  Sent: Thursday, October 10, 2002 8:57 PM
  Subject: Re: [Caml-list] Runtime overflow and what to do

  > But it is the lower bit that is ignored, no, si i guess incrementing an
  > ocaml integer by 1, correspond to incrementing the machine integer by
  > two, and would set the overflow flag in the processor status register
  > all the same, would it not ?

  Yes, except that not all processors have overflow flags.  The Alpha
  and the MIPS don't, for instance.  Integer arithmetic modulo a power
  of 2 is unpleasant for certain applications (and very useful for
  others, e.g. hash functions and cryptography), but this is really all
  what today's processors offer.

  - Xavier Leroy