Skip to content

Commit f24e5ee

Browse files
author
Samori Gorse
committed
-Replaced tabs with 4 spaces
-Renamed tiniest to smallest where applicable
1 parent d109f95 commit f24e5ee

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

decimaljs.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function Decimal(num) {
44
}
55

66
if(num instanceof Decimal) {
7-
return num;
7+
return num;
88
}
99

1010
this.internal = String(num);
@@ -21,19 +21,19 @@ Decimal.prototype._get_repr = function() {
2121

2222

2323
if(!post) {
24-
var trailing_zeros = pre.match(/0+$/);
25-
26-
if(trailing_zeros) {
27-
var l = trailing_zeros[0].length;
28-
value = pre.substr(0, pre.length - l);
29-
exp = l;
30-
} else {
31-
value = pre;
32-
exp = 0;
33-
}
24+
var trailing_zeros = pre.match(/0+$/);
25+
26+
if(trailing_zeros) {
27+
var l = trailing_zeros[0].length;
28+
value = pre.substr(0, pre.length - l);
29+
exp = l;
30+
} else {
31+
value = pre;
32+
exp = 0;
33+
}
3434
} else {
35-
value = parseInt(this.internal.split('.').join(''), 10);
36-
exp = post.length * -1;
35+
value = parseInt(this.internal.split('.').join(''), 10);
36+
exp = post.length * -1;
3737
}
3838

3939
return {'value':value, 'exp':exp};
@@ -46,15 +46,15 @@ Decimal.prototype.add = function(target) {
4646
var ops = [this, target];
4747
ops.sort(function(x, y) { return x.repr.exp - y.repr.exp });
4848

49-
var tiniest = ops[0].repr.exp;
49+
var smallest = ops[0].repr.exp;
5050
var biggest = ops[1].repr.exp;
5151

52-
var fst = Decimal._format(ops[1].repr.value, biggest - tiniest) * 1;
52+
var fst = Decimal._format(ops[1].repr.value, biggest - smallest) * 1;
5353
var snd = ops[0].repr.value * 1;
5454

5555
var calc = String(fst + snd);
5656

57-
return Decimal._format(calc, tiniest);
57+
return Decimal._format(calc, smallest);
5858
}
5959

6060
Decimal.prototype.sub = function(target) {
@@ -84,8 +84,8 @@ Decimal._neg_exp = function(str, position) {
8484
var sep = '.'
8585

8686
if(offset >= 0) {
87-
str = Decimal.__zero(offset) + str;
88-
sep = '0.';
87+
str = Decimal.__zero(offset) + str;
88+
sep = '0.';
8989
}
9090

9191
var length = str.length;
@@ -114,7 +114,7 @@ Decimal.__zero = function(exp) {
114114
for(var i=0; i < methods.length; i++) {
115115
(function(method) {
116116
Decimal[method] = function(a, b) {
117-
return Decimal(a)[method](b);
117+
return Decimal(a)[method](b);
118118
}
119119
})(methods[i]);
120120
}

0 commit comments

Comments
 (0)