Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Brian Hurt <bhurt@janestcapital.com>
To: "Mattias Engdegård" <mattias@virtutech.se>
Cc: jon@ffconsultancy.com, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] if (n:int) < 0 then (-n) > 0 is FALSE
Date: Fri, 08 Dec 2006 13:37:20 -0500	[thread overview]
Message-ID: <4579B0E0.9050304@janestcapital.com> (raw)
In-Reply-To: <200612081820.kB8IKL023123@virtutech.se>

[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

Mattias Engdegård wrote:

>>I wouldn't call it a bug. It looks like modulo arithmetic to me.
>>    
>>
>
>Let's not make a virtue of necessity. The type "int" was likely designed
>with the intent to provide a type that could be used for actual integers
>in a variety of circumstances, while giving good performance. The modulo
>semantics is rarely useful (especially the 30-bit signed variety) but
>is the price paid for reasonable performance with a simple implementation.
>  
>
Actually, the modulo behavior comes out of how the CPU designers made 
the CPUs work decades ago.  It was very easy for them to just drop all 
those extra bits (or not even compute them).  And, of course, now that 
behavior is cast in stone...

Brian


[-- Attachment #2: Type: text/html, Size: 1164 bytes --]

  reply	other threads:[~2006-12-08 18:37 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 [this message]
2006-12-09  2:03           ` skaller
2006-12-07 21:13 ` Martin Jambon

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=4579B0E0.9050304@janestcapital.com \
    --to=bhurt@janestcapital.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=jon@ffconsultancy.com \
    --cc=mattias@virtutech.se \
    /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