From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@lri.fr>
To: N Hur <mapnh@maths.bath.ac.uk>
Cc: caml-list@inria.fr
Subject: Re: Is this OK?
Date: Mon, 18 May 1998 10:03:53 +0200 [thread overview]
Message-ID: <199805180803.KAA00738@pc85.lri.fr> (raw)
In-Reply-To: <Pine.SUN.3.91.980515135653.27393A-100000@thor.maths.bath.ac.uk>
> (* a camllight session *)
>
> #(-234)/4
> ;;
> - : int = -58
>
>
> #div_big_int (big_int_of_string "-234") (big_int_of_string "4");;
> - : big_int = -59
There is OK. Indeed, when defining the quotient and the remainder you
must specify the range of the remainder. Usually, you specify that the
remainder of the division of a by b is between 0 and b-1, whatever is
the sign of a. That is the case in the big_in library.
But in the case of Caml division, the specification is different: the
remainder has the same sign that a, which is negative in your example.
But in both cases you always have
a = b * (a/b) + (a mod b)
which is the expected invariant.
--
Jean-Christophe FILLIATRE
mailto:Jean-Christophe.Filliatre@lri.fr
http://www.lri.fr/~filliatr
next prev parent reply other threads:[~1998-05-18 13:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-05-15 13:02 N Hur
1998-05-18 8:03 ` Jean-Christophe Filliatre [this message]
1998-05-18 12:51 ` Xavier Leroy
1998-05-18 13:59 Damien Doligez
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=199805180803.KAA00738@pc85.lri.fr \
--to=jean-christophe.filliatre@lri.fr \
--cc=caml-list@inria.fr \
--cc=mapnh@maths.bath.ac.uk \
/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