Decimal operator behaviors

Sam Ruby rubys at intertwingly.net
Wed Aug 27 13:41:07 PDT 2008


liorean wrote:
> 2008/8/27 Sam Ruby <rubys at intertwingly.net>:
>> I've updated my SpiderMonkey branch based on my understanding of the
>> outcome of the past few days of discussion, and would appreciate any
>> input that people may have on any other operators.  To facilitate this
>> discussion, I've produced the following sets of tables:
>>
>>  http://intertwingly.net/stories/2008/08/27/estest.html
> 
> I would be interested in seeing some tests covering the behaviour of
> negative infinity and negative zero as well (for comparison with the
> binary double equivalents's behaviour).

I can certainly add "some" tests, but if you could be a little more 
specific of the actual expressions you would like to see evaluated, I 
will be more likely to produce what you want. :-)

Meanwhile, here's a few examples:

js> -1/0 === 1/0
false
js> -1m/0m === 1m/0m
false

js> -0 === 0
true
js> -0m === 0m
true

I'll gladly add the lines above to my test suite as well as any others 
you might suggest.  When we get to the named methods, things might get a 
little more interesting:

js> Decimal.compareTotal(-0m,0m)
-1

This has implications for the fabled Object.eq^h^hidentical method.

- Sam Ruby



More information about the Es-discuss mailing list