9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] More Microsoft bashing
@ 2005-12-16  4:04 Jack Johnson
  2005-12-16  4:51 ` Dan Cross
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Jack Johnson @ 2005-12-16  4:04 UTC (permalink / raw)
  To: 9fans

Not really, but all the talk about Singularity got me poking around
and I came across this:

------

How are the functions DIV and MOD defined?

The following answers are given by the Internal Working Document on
the Common Language Infrastructure (CLI).

result = value1 DIV value2 satisfies the following conditions:
|result| = |value1| / |value2|, and
sign(result) = +, if sign(value1) = sign(value2)
sign(result) = - , if sign(value1) # sign(value2)

result  = value1 MOD value2 satisfies the following conditions:
result = value1 - value2 * (value1 DIV value2), and
0 <= |result| < |value2|, and
sign(result) = sign(value1)

Please note that this definition of DIV and MOD differs from the
definition given in [M. Reiser, N. Wirth. Programming in Oberon. p.
36]:
x  = (x DIV y) * y + (x MOD y), and
0 <= (x MOD y) < y

( from http://www.bluebottle.ethz.ch/oberon.net/faq.html#ad_DivMod )

------

I kind of collect random, older computer science texts, so I cracked
open The Nature of Computation by Pohl and Shaw, which yields:

  "x MOD y = x - (x ÷ y) * y, where ÷ indicates integer division (i.e.
fractions are disregarded; equivalently, the result of the division is
truncated)."

So, what *is* -5 MOD 3?

-Jack


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2005-12-17 11:24 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-16  4:04 [9fans] More Microsoft bashing Jack Johnson
2005-12-16  4:51 ` Dan Cross
2005-12-16  5:02   ` Dan Cross
2005-12-16  5:33     ` erik quanstrom
2005-12-16  5:38       ` Bruce Ellis
2005-12-16 10:46         ` Charles Forsyth
2005-12-16 13:13       ` Dan Cross
2005-12-16  4:53 ` erik quanstrom
2005-12-16  5:08   ` Dan Cross
2005-12-16  5:19     ` Brian L. Stuart
2005-12-16  5:27     ` Bruce Ellis
2005-12-16 14:19     ` Brantley Coile
2005-12-16 15:13       ` Bruce Ellis
2005-12-16 15:29         ` Russ Cox
2005-12-16 16:00           ` Bruce Ellis
2005-12-17  0:26             ` Jack Johnson
2005-12-17  3:59               ` Bruce Ellis
2005-12-16 15:33         ` Brantley Coile
2005-12-16 10:47   ` John Stalker
2005-12-16 14:25     ` Brantley Coile
2005-12-16 14:51       ` Gorka guardiola
2005-12-16 22:28     ` Victor Nazarov
2005-12-17 11:09 ` David Leimbach
2005-12-17 11:24   ` David Leimbach

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).