<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/11/c476429bdc04d501fe234399b1022dcc"
  from="Eray Ozkural &lt;exa@k...&gt;"
  author="Eray Ozkural"
  date="2003-11-07T06:22:33"
  subject="Re: [Caml-list] A grave bug in logical shift right op?"
  prev="2003/11/f965cfe7869fbbf1d10dcfc9a4ef52ea"
  next="2003/11/dce69ef2d7853d6760e22f2fdaaedce0"
  prev-in-thread="2003/11/944504cb86937958edfda29223507e1c"
  next-in-thread="2003/11/f965cfe7869fbbf1d10dcfc9a4ef52ea"
  prev-thread="2003/11/b3c779c49bd7be546f1e9fe0756e7d3d"
  next-thread="2003/11/8bac1133214edc5aaff0c5dae8053b9e"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] A grave bug in logical shift right op?">
<msg 
  url="2003/11/140c9fadd8e2355539503a016bc1e217"
  from="Eray Ozkural &lt;exa@k...&gt;"
  author="Eray Ozkural"
  date="2003-11-07T03:35:12"
  subject="[Caml-list] A grave bug in logical shift right op?">
<msg 
  url="2003/11/6c51cac155fc19a70c332c51f09bb199"
  from="Jed Davis &lt;jdev@p...&gt;"
  author="Jed Davis"
  date="2003-11-07T03:46:32"
  subject="[Caml-list] Re: A grave bug in logical shift right op?">
</msg>
<msg 
  url="2003/11/944504cb86937958edfda29223507e1c"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-11-07T03:53:40"
  subject="Re: [Caml-list] A grave bug in logical shift right op?">
<msg 
  url="2003/11/c476429bdc04d501fe234399b1022dcc"
  from="Eray Ozkural &lt;exa@k...&gt;"
  author="Eray Ozkural"
  date="2003-11-07T06:22:33"
  subject="Re: [Caml-list] A grave bug in logical shift right op?">
</msg>
</msg>
<msg 
  url="2003/11/f965cfe7869fbbf1d10dcfc9a4ef52ea"
  from="Andrew Lenharth &lt;andrewl@d...&gt;"
  author="Andrew Lenharth"
  date="2003-11-07T03:59:13"
  subject="Re: [Caml-list] A grave bug in logical shift right op?">
</msg>
</msg>
</thread>

<contents>
Excuse me for forgetting this fact about the ocaml int type.

Having been too accustomed to C/C++, I must have conditioned myself into 
thinking int couldn't possibly be 31 bits. I swear I had learnt it sometime 
in the past only to forget it :)

Thanks for the clarification.

On Friday 07 November 2003 05:53, Jacques Garrigue wrote:
&gt; Sure, the int type has only 31 bits. In good math,
&gt; (2 ^ 31 - 1) quo 2 ^ 24 is 127, as far as I know.
&gt;
&gt; Note that the problem with your first example has already been
&gt; discussed. A litteral bigger than the biggest possible integer should
&gt; probably trigger an error/exception.
&gt; A bit more curions is your second example: since
&gt; 0xffffffff = 0x7fffffff = -1, converting it to int32 gives -1l (the
&gt; 32-bit value for -1), which happens to be 0xffffffffl.
&gt;
&gt; If you want to do 32-bit computations, you must use only 32-bit
&gt; integers. This shouldn't be too inefficient as long as you use loops
&gt; rather than function calls (the same recommandations as for floats
&gt; apply, I believe).
&gt;
&gt; Jacques Garrigue

-- 
Eray Ozkural (exa) &lt;erayo@cs.bilkent.edu.tr&gt;
Comp. Sci. Dept., Bilkent University, Ankara  KDE Project: http://www.kde.org
www: http://www.cs.bilkent.edu.tr/~erayo  Malfunction: http://mp3.com/ariza
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

