Squeak archeology - quo vs. //
Andreas Raab
andreas.raab at gmx.de
Wed Apr 7 20:51:04 UTC 2004
> 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.
Do you have any examples for this? Right now I would've claimed the opposite
since I don't remember any such problematic cases from the "C days" (which
are a little back admittedly) and the situation in which I was got bitten
was a classic one from graphics and sound, namely sampling:
(b - a) // n * n <= (b - a)
e.g., if we sample the range (b - a) n times we want to get a step size
which ensures that it doesn't exceed the range (b - a) regardless of
direction. Right now, using Squeaks // semantics you get:
(100 - 50) // 3 * 3 -> 48
(50 - 100) // 3 * 3 -> -51
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|