comp.lang.ada
 help / color / mirror / Atom feed
From: Wilhelm.Spickermann@t-online.de (Wilhelm Spickermann)
To: comp.lang.ada@ada.eu.org
Subject: Re: About conversions
Date: 2000/11/23
Date: 2000-11-23T11:00:13+00:00	[thread overview]
Message-ID: <E13yu3q-0006pN-00@pc1.spick.nowhdus> (raw)
In-Reply-To: 200011230621.HAA17785@bulgaria.otn.eurocopter.de

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 865 bytes --]


On 23-Nov-00 Christoph Grein wrote:
> -14 mod 5:
> 
>  There's a common rule: ("Punkt vor Strich" in German) multiplication
> (* / mod 
> rem) before addition (+ -), thus this is
>  
>       -14 mod 5 = -2**2
> 
> You wouldn't fall into the latter trap, would you?
> 
> (Hope I'm correct, did not look it up in ARM :-)

Sorry, but "mod x" always delivers values between 0 and x (x excluded).
So the result is 1 and not -4.

I do like this rule of operation, because adding or subtracting a
multiple of the right operand to the left one will not change the
result of the operation. It would be nice to have a corresponding
division, such that A = (A / B) * B + A mod B. But the Ada definition of
integer division is different -- I don�t know why -- and so we need
"rem" instead of "mod" to make the above equation (and the one You have
given) true.

Wilhelm






  reply	other threads:[~2000-11-23  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-23  6:21 About conversions Christoph Grein
2000-11-23  0:00 ` Wilhelm Spickermann [this message]
2000-11-23  0:00   ` Florian Weimer
2000-11-23  0:00     ` Wilhelm Spickermann
2000-11-28  2:20   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
2000-11-24  0:00 Christoph Grein
2000-11-28  1:33 ` Robert Dewar
2000-11-20  0:00 Sandro Binetti
2000-11-20  0:00 ` Ken Garlington
2000-11-20  0:00   ` Robert Dewar
2000-11-20  0:00     ` Stephen Leake
2000-11-21  0:00       ` Robert Dewar
2000-11-21  0:00         ` Warren W. Gay VE3WWG
2000-11-21  0:00           ` Robert Dewar
2000-11-21  0:00             ` Ted Dennison
2000-11-22  3:27               ` Warren W. Gay VE3WWG
2000-11-22  4:54               ` Robert Dewar
2000-11-22  0:00                 ` Wes Groleau
2000-11-22  0:00                 ` Ted Dennison
2000-11-22  0:00         ` Tristan Gingold
2000-11-24  0:00         ` Jean-Pierre Rosen
2000-11-24  0:00       ` Jean-Pierre Rosen
2000-11-21  2:57     ` DuckE
2000-11-21  0:00       ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox