Squeak archeology - quo vs. //

Andreas Raab andreas.raab at gmx.de
Wed Apr 7 20:55:13 UTC 2004


>     (b - a) // n * n <= (b - a)

Oops. Of course this should have said:

    | (b - a) // n * n | <= | (b - a) |

Sorry for the confusion.

  - A.

----- Original Message ----- 
From: "Andreas Raab" <andreas.raab at gmx.de>
To: "The general-purpose Squeak developers list"
<squeak-dev at lists.squeakfoundation.org>
Sent: Wednesday, April 07, 2004 10:51 PM
Subject: Re: Squeak archeology - quo vs. //


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