On Tue, Sep 13, 2011 at 5:18 PM, Kenta Murata <muraken / gmail.com> wrote:
> Hi,
>
> On Wednesday, September 14, 2011 at 06:23 , brian ford wrote:
>> There is some inconsistency between your proposal and what has been implemented:
>
> We can change the implementation according to the proposal if accepted.

But you have already changed the implementation and your change is
inconsistent with what you are claiming in your response. If you are
not intending to exclude other objects implementing #to_int, then why
did you implement it that way? That's confusing.

>
>> A Float value is a machine approximation of a mathematical real
>> number. A BigDecimal is an exact representation of a real number. The
>> mathematical real numbers embed the integers.
>
> You are not right.
> A BigDecimal is a floating-point number same as a Float except for internal representation.
> So, A BigDecimal is also approximation of a real number,
> in other words, a BigDecimal has error as well as a Float does.
> It is right understanding because I am the master of bigdecimal.

BigDecimal is an arbitrary precision floating-point library. There are
other arbitrary precision floating-point libraries. The
characteristics of BigDecimal really have nothing to do with this
discussion anyway.

A real-number approximation can be easily represented as an integral
value any number of ways. It can be consistently represented using any
one of those any number of ways. A real-number approximation is no
less and no more an integral value than the Numberish object in my
example. There is no reason to introduce this arbitrary distinction in
Ruby. I could just as easily define Numberish as:

class Numberish
  def initialize(value)
    @value = value
  end

  def to_int
    @value.to_i # or *anything* else, even just 1
  end
end

n = Numberish 4.2

Why is this change needed? Please don't reiterate this argument about
imprecise floating-point values. What problems does this change fix?

Thanks,
Brian

>
>> It is untrue that Float numbers cannot be consistently represented as
>> integral values. It is merely up to the language to define them as
>> such. Ruby already takes liberties with defining mathematical
>> operations (see http://redmine.ruby-lang.org/issues/3289).
>
> I know. I suggest to change for number system.
>
>> To remove #to_int from Float and BigDecimal and partially from
>> Rational and Complex introduces typing concepts where none are needed,
>> breaks consistent polymorphism, and breaks compatibility with 1.8 and
>> prior 1.9.
>
> Yes, my proposal introduces incompatibility, so I propose this for 2.0.
>
> --
> Kenta Murata
> Sent with Sparrow (http://www.sparrowmailapp.com)
>
>
>
>