From: Paul Brannan Date: 2004-06-04T22:59:07+09:00 Subject: Re: [RCR] Floating point division operator /. (or fdiv method) On Fri, Jun 04, 2004 at 09:48:00AM +0900, Jim Weirich wrote: > Robert Klemme wrote: > >I strongly oppose that one: Operators are overloaded and if I have two > >int's I want integer division, if I have to floats I want float division. > >And I don't want that changed, because often code is written with integer > >divisions in mind. All sorts of indexing calculations depend on int math. > > Then your code will break whenever it is used in a program that requires > "mathn". You should always use div if you want integer division. > The truth is that Ruby's / operator is broken. I strongly disagree. It is mathn that is broken, not the / operator. I use / all the time to indicate integer division (provided I'm working with integers). My code will not work with mathn and I have no intention of going out of my way to uglify my code just to make it compatible with a broken library. I've said it before and I will say it again. Code that changes builtin classes without a really good reason (YAML is one such example) is broken. See [ruby-talk:81923] for what I've written in the past on this subject. If we get selector namespaces in ruby 2.0, then mathn can be rewritten such that users can get floating-point division with / in their namespace only. Until then I recommend not using mathn. Paul