[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:03772] Re: modulo and remainder

From: matz@... (Yukihiro Matsumoto)
Date: 2000-07-03 17:33:08 UTC
List: ruby-talk #3772
Hi,

In message "[ruby-talk:03766] modulo and remainder"
    on 00/07/03, Dave Thomas <Dave@thomases.com> writes:

|However, in the old scheme of things, these were different operators.
|
|Has the decision now been made to unify them?

In short, yes.

Ruby's behavior for quotient, modulo and remainder was mixture of C,
Python, Scheme, etc.  And was pretty inconsistent.  After days of
pondering, I finally decided the behavior of fmod(3m) to be followed.

       The fmod() function computes the remainder of dividing x by
       y.  The return value is x - n * y, where n is the quotient of
       x / y, rounded towards zero to an integer.

So I hacked Numeric classes, and made them consistent.  I still have
to update the test suite.  `make test' fails now.

We lost old % (modulo) behavior, but who on earth use modulo for
nagative operands. ;-)

							matz.

In This Thread