Lines Matching defs:this

3  * Use of this source code is governed by a BSD-style license that can be
8 this.reset_({precision: precision});
27 var operator = this.operand && this.operator;
28 var result = this.calculate_(operator, this.operand);
29 return this.reset_({accumulator: result, operator: input});
36 var operator = this.operator || this.defaults.operator;
37 var operand = this.operator ? this.operand : this.defaults.operand;
38 var result = this.calculate_(operator, operand);
39 var defaults = {operator: operator, operand: this.operand};
40 return this.reset_({accumulator: result, defaults: defaults});
42 return this.reset_({});
44 return this.operand ? this.set_({operand: null}) :
45 this.operator ? this.set_({operator: null}) :
46 this.handle('AC');
48 var length = (this.operand || '').length;
49 return (length > 1) ? this.set_({operand: this.operand.slice(0, -1)}) :
50 this.operand ? this.set_({operand: null}) :
51 this.set_({operator: null});
53 var initial = (this.operand || '0')[0];
54 return (initial === '-') ? this.set_({operand: this.operand.slice(1)}) :
55 (initial !== '0') ? this.set_({operand: '-' + this.operand}) :
56 this.set_({});
58 var operand = (this.operand || '0') + input;
60 var overflow = (operand.replace(/[^0-9]/g, '').length > this.precision);
61 return operand.match(/^0[0-9]/) ? this.set_({operand: operand[1]}) :
62 (!duplicate && !overflow) ? this.set_({operand: operand}) :
63 this.set_({});
73 this.accumulator = this.operand = this.operator = null;
74 this.defaults = {operator: null, operand: null};
75 return this.set_(state);
85 var precision = (state && state.precision) || this.precision || 9;
86 this.precision = Math.min(Math.max(precision, 1), 9);
87 this.accumulator = ifDefined(state && state.accumulator, this.accumulator);
88 this.operator = ifDefined(state && state.operator, this.operator);
89 this.operand = ifDefined(state && state.operand, this.operand);
90 this.defaults = ifDefined(state && state.defaults, this.defaults);
91 return this;
102 var x = Number(this.accumulator) || 0;
104 this.set_({accumulator: String(x), operator: operator, operand: String(y)});
105 return (this.operator == '+') ? this.round_(x + y) :
106 (this.operator == '-') ? this.round_(x - y) :
107 (this.operator == '*') ? this.round_(x * y) :
108 (this.operator == '/') ? this.round_(x / y) :
109 this.round_(y);
119 var exponent = Number(x.toExponential(this.precision - 1).split('e')[1]);
120 var digits = this.digits_(exponent);
122 var fixed = (Math.abs(exponent) < this.precision && exponent > -7);
134 (exponent < -99) ? (this.precision - 1 - 5) :
135 (exponent < -9) ? (this.precision - 1 - 4) :
136 (exponent < -6) ? (this.precision - 1 - 3) :
137 (exponent < 0) ? (this.precision - 1 + exponent) :
138 (exponent < this.precision) ? (this.precision - 1) :
139 (exponent < 10) ? (this.precision - 1 - 3) :
140 (exponent < 100) ? (this.precision - 1 - 4) :
141 (this.precision - 1 - 5);