pimath 0.0.77 → 0.0.78
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/pi.js +16 -2
- package/dist/pi.js.map +1 -1
- package/dist/pi.min.js +1 -1
- package/dist/pi.min.js.map +1 -1
- package/esm/maths/coefficients/fraction.js +3 -1
- package/esm/maths/coefficients/fraction.js.map +1 -1
- package/esm/maths/numeric.d.ts +1 -0
- package/esm/maths/numeric.js +12 -0
- package/esm/maths/numeric.js.map +1 -1
- package/esm/maths/randomization/random.d.ts +1 -1
- package/esm/maths/randomization/random.js +1 -1
- package/esm/maths/randomization/random.js.map +1 -1
- package/package.json +1 -1
- package/src/maths/coefficients/fraction.ts +6 -2
- package/src/maths/numeric.ts +12 -0
- package/src/maths/randomization/random.ts +2 -2
- package/tests/coefficients/fraction.test.ts +11 -3
package/dist/pi.js
CHANGED
|
@@ -4063,7 +4063,9 @@ class Fraction {
|
|
|
4063
4063
|
else {
|
|
4064
4064
|
// The given value is a float number
|
|
4065
4065
|
// Get the number of decimals after the float sign
|
|
4066
|
-
let
|
|
4066
|
+
let [unit, decimal] = (value.toString()).split('.');
|
|
4067
|
+
let p = decimal.length;
|
|
4068
|
+
// Detect if the decimal part is periodic or not...
|
|
4067
4069
|
// Transform the float number in two integer
|
|
4068
4070
|
if (denominatorOrPeriodic === undefined) {
|
|
4069
4071
|
this._numerator = value * Math.pow(10, p);
|
|
@@ -6563,6 +6565,18 @@ class Numeric {
|
|
|
6563
6565
|
}
|
|
6564
6566
|
return value;
|
|
6565
6567
|
}
|
|
6568
|
+
static periodic(value) {
|
|
6569
|
+
if (Number.isSafeInteger(value)) {
|
|
6570
|
+
return 0;
|
|
6571
|
+
}
|
|
6572
|
+
// Assume it's with decimal.
|
|
6573
|
+
let decimal = (value.toString()).split('.')[0];
|
|
6574
|
+
// The decimal part is limited
|
|
6575
|
+
if (decimal.length < 10) {
|
|
6576
|
+
return 0;
|
|
6577
|
+
}
|
|
6578
|
+
// Find the periodic if it exists.
|
|
6579
|
+
}
|
|
6566
6580
|
}
|
|
6567
6581
|
exports.Numeric = Numeric;
|
|
6568
6582
|
|
|
@@ -6629,7 +6643,7 @@ var Random;
|
|
|
6629
6643
|
}
|
|
6630
6644
|
Random.item = item;
|
|
6631
6645
|
function shuffle(arr) {
|
|
6632
|
-
rndHelpers_1.rndHelpers.shuffleArray(arr);
|
|
6646
|
+
return rndHelpers_1.rndHelpers.shuffleArray(arr);
|
|
6633
6647
|
}
|
|
6634
6648
|
Random.shuffle = shuffle;
|
|
6635
6649
|
})(Random = exports.Random || (exports.Random = {}));
|