updating js-numbers with uncompressed version to make it easier to profile

This commit is contained in:
Danny Yoo 2012-02-21 20:55:20 -05:00
parent b7ac392030
commit bd19a1e66a
3 changed files with 34 additions and 5 deletions

View File

@ -240,7 +240,21 @@ if (typeof(exports) !== 'undefined') {
// add: scheme-number scheme-number -> scheme-number
var add = makeNumericBinop(
var add = function(x, y) {
var sum;
if (typeof(x) === 'number' && typeof(y) === 'number') {
sum = x + y;
if (isOverflow(sum)) {
return (makeBignum(x)).add(makeBignum(y));
}
}
if (x instanceof FloatPoint && y instanceof FloatPoint) {
return x.add(y);
}
return addSlow(x, y);
};
var addSlow = makeNumericBinop(
function(x, y) {
var sum = x + y;
if (isOverflow(sum)) {
@ -284,7 +298,22 @@ if (typeof(exports) !== 'undefined') {
// mulitply: scheme-number scheme-number -> scheme-number
var multiply = makeNumericBinop(
var multiply = function(x, y) {
var prod;
if (typeof(x) === 'number' && typeof(y) === 'number') {
prod = x * y;
if (isOverflow(prod)) {
return (makeBignum(x)).multiply(makeBignum(y));
} else {
return prod;
}
}
if (x instanceof FloatPoint && y instanceof FloatPoint) {
return x.multiply(y);
}
return multiplySlow(x, y);
};
var multiplySlow = makeNumericBinop(
function(x, y) {
var prod = x * y;
if (isOverflow(prod)) {

View File

@ -840,7 +840,7 @@
if (typeof(x) === 'number' && typeof(y) === 'number') {
sum = x + y;
if (sum < -9e15 || sum > 9e15) {
return checkedAddSlowPath(M, Array.prototype.slice.call(arguments, 1));
return plt.baselib.numbers.add(x, y);
}
return sum;
} else {
@ -881,7 +881,7 @@
if (typeof(x) === 'number' && typeof(y) === 'number') {
prod = x * y;
if (prod < -9e15 || prod > 9e15) {
return checkedMulSlowPath(M, Array.prototype.slice.call(arguments, 1));
return plt.baselib.numbers.multiply(x, y);
}
return prod;
} else {

View File

@ -7,4 +7,4 @@
(provide version)
(: version String)
(define version "1.162")
(define version "1.163")