From: skaller <skaller@users.sourceforge.net>
To: Brian Hurt <bhurt@janestcapital.com>
Cc: "Mattias Engdegård" <mattias@virtutech.se>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] if (n:int) < 0 then (-n) > 0 is FALSE
Date: Sat, 09 Dec 2006 13:03:19 +1100 [thread overview]
Message-ID: <1165629799.10557.18.camel@rosella.wigram> (raw)
In-Reply-To: <4579B0E0.9050304@janestcapital.com>
On Fri, 2006-12-08 at 13:37 -0500, Brian Hurt wrote:
> 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...
More precisely I think: CPU's have always preserved the information
in flags. The culprit here, as usual, is the C programming language.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
next prev parent reply other threads:[~2006-12-09 2:03 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 [this message]
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=1165629799.10557.18.camel@rosella.wigram \
--to=skaller@users.sourceforge.net \
--cc=bhurt@janestcapital.com \
--cc=caml-list@yquem.inria.fr \
--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