Decimal operator behaviors
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:
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).
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:
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
On Wed, Aug 27, 2008 at 4:41 PM, Sam Ruby <rubys at intertwingly.net> wrote:
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:
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. :-)
I've received some off-list feedback, and added a few tests of my own. Updated results can be seen here:
intertwingly.net/stories/2008/08/29/estest.html
Summary: IEEE 754 Decimal Floating Point operations are consistent with IEEE 754 Binary Floating Point operations. The only operations that required any attention was relational operations involving NaN's. If you have any additional expressions you would like to see evaluated, don't hesitate to ask.
- Sam Ruby
A few days ago, we had an extensive discussion, primarily about strict equality, mixed binary double / decimal quad operations and the typeof operator. Perhaps there are other issues that we haven't explored just yet: the behavior of instanceof or constructors, perhaps?
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:
intertwingly.net/stories/2008/08/27/estest.html
The parts above the line are simply the output from the test tool, which shows that the results in the tables below actually do represent running code. The tables below the line are organized by specification section, and demonstrate a number of permutations of data types and ES operators.
Once this discussion is complete, I'll produce similar tables for named methods (both instance and "static"). I imagine that this latter exercise will generate considerably less discussion.