Even with the floor behaviour on signed numbers, that's still useful for many purposes just by itself. What makes sense or not is how you apply it.dougeff wrote:My opinion is that bit shifting only makes sense for unsigned numbers.
Whether you need round toward zero depends on the situation. It might be what you expect for division on signed numbers, as it is the default in several programming languages, and is how we might truncate a written decimal number.
If you want the negative and positive to be symmetrical, you want round toward zero. On 6502 that means signed division is more expensive, requiring a few more operations, but that's true of so many of its signed operations.
If you want a continuous modulo across positive and negative space, you want round down instead. In some cases, this may also help balance rounding errors and increase numerical stability, e.g. if generating a sine wave this way, negative rounding errors may cancel positive rounding errors in a way they wouldn't if you had rounded toward zero.
In other cases the rounding error is small enough to be unimportant, and you might just go with whatever's fastest. In this case, you can probably accept the round down behaviour for efficiency's sake. (On a ones' complement platform, round to zero might be faster.)
There's a time and place for both of these behaviours. Both of them make sense, but I think the round down behaviour is a little bit unexpected when you're used to round to zero (C, C++, x86 IDIV, etc.). I know I didn't think of it right away.