ts-fsrs 5.3.2 → 5.3.3
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/CHANGELOG.md +6 -0
- package/dist/index.cjs +11 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +11 -7
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +11 -7
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# ts-fsrs
|
|
2
2
|
|
|
3
|
+
## 5.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#353](https://github.com/open-spaced-repetition/ts-fsrs/pull/353) [`fce96ee`](https://github.com/open-spaced-repetition/ts-fsrs/commit/fce96eeba51c84a82f00c827e6157333e0522985) Thanks [@ishiko732](https://github.com/ishiko732)! - fix(clipParameters): clamp w[11]/w[13]/w[14] before computing the w[17]/w[18] ceiling so that out-of-range inputs (e.g. 0 or negative values) no longer produce NaN/-Infinity via Math.log, and avoid invoking CLAMP_PARAMETERS twice by reusing the same clip ranges.
|
|
8
|
+
|
|
3
9
|
## 5.3.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -483,7 +483,7 @@ function alea(seed) {
|
|
|
483
483
|
return prng;
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
-
const version="5.3.
|
|
486
|
+
const version="5.3.3";
|
|
487
487
|
|
|
488
488
|
const default_request_retention = 0.9;
|
|
489
489
|
const default_maximum_interval = 36500;
|
|
@@ -554,15 +554,19 @@ const CLAMP_PARAMETERS = (w17_w18_ceiling, enable_short_term = default_enable_sh
|
|
|
554
554
|
];
|
|
555
555
|
|
|
556
556
|
const clipParameters = (parameters, numRelearningSteps, enableShortTerm = default_enable_short_term) => {
|
|
557
|
-
|
|
558
|
-
if (Math.max(0, numRelearningSteps) > 1) {
|
|
559
|
-
const value = -(Math.log(parameters[11]) + Math.log(Math.pow(2, parameters[13]) - 1) + parameters[14] * 0.3) / numRelearningSteps;
|
|
560
|
-
w17_w18_ceiling = clamp(+value.toFixed(8), 0.01, 2);
|
|
561
|
-
}
|
|
562
|
-
const clip = CLAMP_PARAMETERS(w17_w18_ceiling, enableShortTerm).slice(
|
|
557
|
+
const clip = CLAMP_PARAMETERS(W17_W18_Ceiling, enableShortTerm).slice(
|
|
563
558
|
0,
|
|
564
559
|
parameters.length
|
|
565
560
|
);
|
|
561
|
+
if (Math.max(0, numRelearningSteps) > 1) {
|
|
562
|
+
const w11 = clamp(parameters[11] || 0, clip[11][0], clip[11][1]);
|
|
563
|
+
const w13 = clamp(parameters[13] || 0, clip[13][0], clip[13][1]);
|
|
564
|
+
const w14 = clamp(parameters[14] || 0, clip[14][0], clip[14][1]);
|
|
565
|
+
const value = -(Math.log(w11) + Math.log(Math.pow(2, w13) - 1) + w14 * 0.3) / numRelearningSteps;
|
|
566
|
+
const w17_w18_ceiling = clamp(roundTo(value, 8), 0.01, W17_W18_Ceiling);
|
|
567
|
+
if (clip[17]) clip[17] = [clip[17][0], w17_w18_ceiling];
|
|
568
|
+
if (clip[18]) clip[18] = [clip[18][0], w17_w18_ceiling];
|
|
569
|
+
}
|
|
566
570
|
return clip.map(
|
|
567
571
|
([min, max], index) => clamp(parameters[index] || 0, min, max)
|
|
568
572
|
);
|