Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Martin Jambon <martin1977@laposte.net>
To: Pal-Kristian Engstad <pal_engstad@naughtydog.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] if (n:int) < 0 then (-n) > 0 is FALSE
Date: Thu, 7 Dec 2006 13:13:19 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0612071309150.13303@localhost> (raw)
In-Reply-To: <45785E27.8050804@naughtydog.com>

On Thu, 7 Dec 2006, Pal-Kristian Engstad wrote:

> To find that it loops forever. The reason is that 1024*1024*1024=2^30
> cannot be represented as a positive number on 32-bit platforms, hence it
> silently converts it to -1073741824, or -2^30. The reason this loops
> again is that -n = -(-20^30) = -20^30......, still negative!
>
> This is obviously a bug - has it since been fixed? But more alarmingly -
> why is there no warning?

For what it's worth, you can have a look at "Overflow":

  http://sebastien.ailleret.perso.cegetel.net/caml/

(I haven't tried it)


Martin

--
Martin Jambon, PhD
http://martin.jambon.free.fr


      parent reply	other threads:[~2006-12-07 21:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-07 18:32 Pal-Kristian Engstad
2006-12-07 19:19 ` [Caml-list] " Jonathan Roewen
2006-12-07 19:43   ` Mattias Engdegård
2006-12-07 20:02     ` Brian Hurt
2006-12-08  2:37     ` skaller
2006-12-08 11:09       ` Mattias Engdegård
2006-12-08 17:48     ` Jon Harrop
2006-12-08 18:20       ` Mattias Engdegård
2006-12-08 18:37         ` Brian Hurt
2006-12-09  2:03           ` skaller
2006-12-07 21:13 ` Martin Jambon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0612071309150.13303@localhost \
    --to=martin1977@laposte.net \
    --cc=caml-list@inria.fr \
    --cc=pal_engstad@naughtydog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox