fable 3.0.114 → 3.0.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fable.compatible.js +12 -6
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +12 -6
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +1 -1
- package/source/services/Fable-Service-Math.js +83 -0
- package/test/Math_test.js +16 -0
package/package.json
CHANGED
|
@@ -107,6 +107,16 @@ class FableServiceMath extends libFableServiceBase
|
|
|
107
107
|
return tmpResult.toString();
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
powerPrecise(pLeftValue, pRightValue)
|
|
111
|
+
{
|
|
112
|
+
let tmpLeftValue = isNaN(pLeftValue) ? 0 : pLeftValue;
|
|
113
|
+
let tmpRightValue = isNaN(pRightValue) ? 0 : pRightValue;
|
|
114
|
+
|
|
115
|
+
let tmpLeftArbitraryValue = new this.fable.Utility.bigNumber(tmpLeftValue);
|
|
116
|
+
let tmpResult = tmpLeftArbitraryValue.pow(tmpRightValue);
|
|
117
|
+
return tmpResult.toString();
|
|
118
|
+
}
|
|
119
|
+
|
|
110
120
|
multiplyPrecise(pLeftValue, pRightValue)
|
|
111
121
|
{
|
|
112
122
|
let tmpLeftValue = isNaN(pLeftValue) ? 0 : pLeftValue;
|
|
@@ -126,6 +136,79 @@ class FableServiceMath extends libFableServiceBase
|
|
|
126
136
|
let tmpResult = tmpLeftArbitraryValue.div(tmpRightValue);
|
|
127
137
|
return tmpResult.toString();
|
|
128
138
|
}
|
|
139
|
+
|
|
140
|
+
modPrecise(pLeftValue, pRightValue)
|
|
141
|
+
{
|
|
142
|
+
let tmpLeftValue = isNaN(pLeftValue) ? 0 : pLeftValue;
|
|
143
|
+
let tmpRightValue = isNaN(pRightValue) ? 0 : pRightValue;
|
|
144
|
+
|
|
145
|
+
let tmpLeftArbitraryValue = new this.fable.Utility.bigNumber(tmpLeftValue);
|
|
146
|
+
let tmpResult = tmpLeftArbitraryValue.mod(tmpRightValue);
|
|
147
|
+
return tmpResult.toString();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
sqrtPrecise(pValue)
|
|
151
|
+
{
|
|
152
|
+
let tmpValue = isNaN(pValue) ? 0 : pValue;
|
|
153
|
+
|
|
154
|
+
let tmpLeftArbitraryValue = new this.fable.Utility.bigNumber(tmpValue);
|
|
155
|
+
let tmpResult = tmpLeftArbitraryValue.sqrt();
|
|
156
|
+
return tmpResult.toString();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
absPrecise(pValue)
|
|
160
|
+
{
|
|
161
|
+
let tmpValue = isNaN(pValue) ? 0 : pValue;
|
|
162
|
+
|
|
163
|
+
let tmpLeftArbitraryValue = new this.fable.Utility.bigNumber(tmpValue);
|
|
164
|
+
let tmpResult = tmpLeftArbitraryValue.abs();
|
|
165
|
+
return tmpResult.toString();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
comparePrecise(pLeftValue, pRightValue)
|
|
169
|
+
{
|
|
170
|
+
let tmpLeftValue = isNaN(pLeftValue) ? 0 : pLeftValue;
|
|
171
|
+
let tmpRightValue = isNaN(pRightValue) ? 0 : pRightValue;
|
|
172
|
+
|
|
173
|
+
let tmpLeftArbitraryValue = new this.fable.Utility.bigNumber(tmpLeftValue);
|
|
174
|
+
return tmpLeftArbitraryValue.cmp(tmpRightValue);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
gtPrecise(pLeftValue, pRightValue)
|
|
178
|
+
{
|
|
179
|
+
let tmpLeftValue = isNaN(pLeftValue) ? 0 : pLeftValue;
|
|
180
|
+
let tmpRightValue = isNaN(pRightValue) ? 0 : pRightValue;
|
|
181
|
+
|
|
182
|
+
let tmpLeftArbitraryValue = new this.fable.Utility.bigNumber(tmpLeftValue);
|
|
183
|
+
return tmpLeftArbitraryValue.gt(tmpRightValue);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
gtePrecise(pLeftValue, pRightValue)
|
|
187
|
+
{
|
|
188
|
+
let tmpLeftValue = isNaN(pLeftValue) ? 0 : pLeftValue;
|
|
189
|
+
let tmpRightValue = isNaN(pRightValue) ? 0 : pRightValue;
|
|
190
|
+
|
|
191
|
+
let tmpLeftArbitraryValue = new this.fable.Utility.bigNumber(tmpLeftValue);
|
|
192
|
+
return tmpLeftArbitraryValue.gte(tmpRightValue);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
ltPrecise(pLeftValue, pRightValue)
|
|
196
|
+
{
|
|
197
|
+
let tmpLeftValue = isNaN(pLeftValue) ? 0 : pLeftValue;
|
|
198
|
+
let tmpRightValue = isNaN(pRightValue) ? 0 : pRightValue;
|
|
199
|
+
|
|
200
|
+
let tmpLeftArbitraryValue = new this.fable.Utility.bigNumber(tmpLeftValue);
|
|
201
|
+
return tmpLeftArbitraryValue.lt(tmpRightValue);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
ltePrecise(pLeftValue, pRightValue)
|
|
205
|
+
{
|
|
206
|
+
let tmpLeftValue = isNaN(pLeftValue) ? 0 : pLeftValue;
|
|
207
|
+
let tmpRightValue = isNaN(pRightValue) ? 0 : pRightValue;
|
|
208
|
+
|
|
209
|
+
let tmpLeftArbitraryValue = new this.fable.Utility.bigNumber(tmpLeftValue);
|
|
210
|
+
return tmpLeftArbitraryValue.lt(tmpRightValue);
|
|
211
|
+
}
|
|
129
212
|
}
|
|
130
213
|
|
|
131
214
|
module.exports = FableServiceMath;
|
package/test/Math_test.js
CHANGED
|
@@ -43,6 +43,22 @@ suite
|
|
|
43
43
|
Expect(testFable.Math.percentagePrecise(0, 0)).to.equal('0');
|
|
44
44
|
Expect(testFable.Math.percentagePrecise(500, 100)).to.equal('500');
|
|
45
45
|
Expect(testFable.Math.percentagePrecise(100, 500)).to.equal('20');
|
|
46
|
+
|
|
47
|
+
Expect(testFable.Math.powerPrecise(4,4)).to.equal('256');
|
|
48
|
+
Expect(testFable.Math.powerPrecise(5,2)).to.equal('25');
|
|
49
|
+
Expect(testFable.Math.powerPrecise(50,7)).to.equal('781250000000');
|
|
50
|
+
Expect(testFable.Math.sqrtPrecise(4)).to.equal('2');
|
|
51
|
+
|
|
52
|
+
Expect(testFable.Math.gtPrecise(4, 5)).to.equal(false);
|
|
53
|
+
Expect(testFable.Math.gtePrecise(1000, 5)).to.equal(true);
|
|
54
|
+
Expect(testFable.Math.ltePrecise(1000, 5)).to.equal(false);
|
|
55
|
+
Expect(testFable.Math.ltPrecise(4, 5)).to.equal(true);
|
|
56
|
+
|
|
57
|
+
Expect(testFable.Math.comparePrecise(4, 5)).to.equal(-1);
|
|
58
|
+
|
|
59
|
+
Expect(testFable.Math.modPrecise(4.939323, 4)).to.equal('0.939323');
|
|
60
|
+
|
|
61
|
+
Expect(testFable.Math.absPrecise('-492')).to.equal('492');
|
|
46
62
|
|
|
47
63
|
return fDone();
|
|
48
64
|
}
|