caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jérémie Dimino" <jeremie@dimino.org>
To: Elnatan Reisner <elnatan@cs.umd.edu>
Cc: Caml Mailing List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Int64 comparison
Date: Tue, 17 Mar 2009 16:13:07 +0100	[thread overview]
Message-ID: <1237302787.23290.10.camel@localhost.localdomain> (raw)
In-Reply-To: <FC17C629-D605-46B3-9690-85A119E9B223@cs.umd.edu>

Le mardi 17 mars 2009 à 08:51 -0400, Elnatan Reisner a écrit :
> Do the polymorphic ordering functions -- (<), (>), etc. -- correspond  
> to the numerical ordering for Int64s and Int32s? I assume so, but I  
> didn't see this specified anywhere.

Yes, int64s and int32s are represented in memory by custom blocks [1],
so there is a specific comparison functions for them.

> If the answer is 'yes', is there a reason I should prefer
> Int64.compare n1 n2 < 0
> to
> n1 < n2
> ?

They may be compiled differently if the compiler does not know that n1
and n2 are of type int32 or int64 in the second case, but the result
will be the same. You can have look at [2], paragraph "Polymorphic
types" for details.

Jérémie

[1] http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html#toc136

[2] http://www.ocaml-tutorial.org/performance_and_profiling


      parent reply	other threads:[~2009-03-17 15:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17 12:51 Elnatan Reisner
2009-03-17 13:12 ` [Caml-list] " Till Varoquaux
2009-03-17 15:13 ` Jérémie Dimino [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=1237302787.23290.10.camel@localhost.localdomain \
    --to=jeremie@dimino.org \
    --cc=caml-list@yquem.inria.fr \
    --cc=elnatan@cs.umd.edu \
    /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;
as well as URLs for NNTP newsgroup(s).