Alex Vincent wrote:
var x = new SmallDecimal(2);
var y = new SmallDecimal(3);
[x y, x y, x == y, x = y, x = y, x != y]
valueOf doesn't work for SmallDecimal(2) == SmallDecimal(2), though. You
have to hash-cons, which kils performance.
String relational order is wrong for numeric types, to
I like the idea of value types, but I wonder if, for terminating decimal
numbers, the .valueOf() method from Object.prototype might be sufficient
for many operations.
Example:
function SmallDecimal(k) {
this.__value__ = k;
}
SmallDecimal.prototype.valueOf = function() {
return
2 matches
Mail list logo