Es-discuss - several decimal discussions

Sam Ruby rubys at
Sun Aug 24 20:09:16 PDT 2008

On Sun, Aug 24, 2008 at 10:44 PM, Brendan Eich <brendan at> wrote:
> On Aug 24, 2008, at 7:38 PM, Sam Ruby wrote:
>> On Sun, Aug 24, 2008 at 10:01 PM, Brendan Eich
>> <brendan at> wrote:
>>> On Aug 24, 2008, at 6:51 PM, Mark S. Miller wrote:
>>>> On Sun, Aug 24, 2008 at 5:40 PM, Brendan Eich <brendan at>
>>>> wrote:
>>>>> Why is eq being proposed whatever happens with Decimal?
>>>> Because in the absence of decimal, === is close enough to an
>>>> "identical" test that one can practically code around the problem
>>>> cases (NaN and -0)
>>> You're assuming 1.0m === 1.00m must be true. I'm disputing that (see
>>> exchange with Sam, who may agree).
>> I agree that you are disputing that.  ;-P
>> Less than 10 hours ago, ISTR you were suggesting the opposite.
>> "there's a weak case for false"...
> I acknowledged that and then went on to shoot it down, you're right.
> But really, I'm wondering why it is important to have Object.eq if
> 1.0m === 1.00m. Without Object.hashcode. The weak case I mentioned
> would not need Object.eq. The strong case I favored left users
> reaching for compareTotal or stringification and ===. Either way I do
> not see the necessity of eq.
> Sorry, I misstated your position (I think!). What's your position,
> for sure?

You didn't mistake my position.  Here's what I think (for the moment, at least):

If there were an Object.eq method, then 1.1m and 1.10m should be
considered different by such a function.

I don't believe that decimal, by itself, justifies the addition of an
Object.eq method.  Even if we were to go with 1.0m == 1.00m.

As to what the what the value of 1.0m == 1.00m should be, the amount
of code and the amount of spec writing effort is the same either way.
I can see arguments both ways.  But if it were up to me, the
tiebreaker would be what the value of typeof(1.1m) is.  If "number",
the scale tips slightly towards the answer being false.  If "object",
then then scale is firmly on the side of the answer being true.

All things considered, I would argue for false.  I just wouldn't dig
in my heels while doing so.

- Sam Ruby

More information about the Es-discuss mailing list