From: Vincent Fourmond Date: 2006-09-30T20:52:31+09:00 Subject: Re: Integer division with / - request explanation of behavior Hello ! > 2) Is the reason for the behavior of "/" is that this is the behavior of > "/" in C? Why is it that way in C? Here's a couple of reasons: * C is mapping this operation directly to assembly. Old x86 processors used to be able to manipulate only integers, so the result of the division of one integer by another had to be an integer; * the architecture for processing floats is way more complex and less portable than the one from integers (integer arithmetic is the same on every single processor in the world; float arithmetic is a nightmare); * floats are much slower to manipulate, even in assembly code; * in ruby, integers are hard-coded as immediate values, whereas floats are embedded into a complex data structure. You wouldn't want to invoke a really heavy machinery for an integer division... Does that sound correct to you ? Cheers, Vince