Squeak archeology - quo vs. //
Hans-Martin Mosner
hmm at heeg.de
Wed Apr 7 20:29:43 UTC 2004
Dan Ingalls wrote:
>>
>>
>I have always strongly disliked this particular convention.
>
>Someone else was in charge of arithmetic (mainly LargeInts) when we settled on the ST-80 standard and I withdrew from the fray after expressing my opposition. I was told that a lot of mathematicians (which I am not, in the formal sense) expect integer division to truncate toward negative infinity, and I had to trust that this was a good decision for Smalltalk.
>
>
>
There are good reasons for both points of view, and it's good to have
both operations around.
One nice property of \\ and // as they are defined right now is that
(a // b) = ((a + (n*b)) // (b + n))
even if n is negative (that is, the operation is invariant under
translation <what's the correct mathematical term for this>)
As you have noted, especially in computer graphics this is an important
property, as you will have weird effects around zero if you round
towards zero.
Cheers,
Hans-Martin
More information about the Squeak-dev
mailing list
|