ts-fsrs 5.4.0 → 5.4.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # ts-fsrs
2
2
 
3
+ ## 5.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#368](https://github.com/open-spaced-repetition/ts-fsrs/pull/368) [`c392245`](https://github.com/open-spaced-repetition/ts-fsrs/commit/c3922456e07aac536570e5aeb3598f7090202c7d) Thanks [@cantalupo555](https://github.com/cantalupo555)! - fix(clipParameters): apply sqrt ceiling to w[17]/w[18] to prevent constraint violation during relearning
8
+
3
9
  ## 5.4.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -500,7 +500,7 @@ function alea(seed) {
500
500
  return prng;
501
501
  }
502
502
 
503
- const version="5.4.0";
503
+ const version="5.4.1";
504
504
 
505
505
  const default_request_retention = 0.9;
506
506
  const default_maximum_interval = 36500;
@@ -580,7 +580,11 @@ const clipParameters = (parameters, numRelearningSteps, enableShortTerm = defaul
580
580
  const w13 = clamp(parameters[13] || 0, clip[13][0], clip[13][1]);
581
581
  const w14 = clamp(parameters[14] || 0, clip[14][0], clip[14][1]);
582
582
  const value = -(Math.log(w11) + Math.log(Math.pow(2, w13) - 1) + w14 * 0.3) / numRelearningSteps;
583
- const w17_w18_ceiling = clamp(roundTo(value, 8), 0.01, W17_W18_Ceiling);
583
+ const w17_w18_ceiling = clamp(
584
+ roundTo(Math.sqrt(Math.max(value, 0)), 8),
585
+ 0.01,
586
+ W17_W18_Ceiling
587
+ );
584
588
  if (clip[17]) clip[17] = [clip[17][0], w17_w18_ceiling];
585
589
  if (clip[18]) clip[18] = [clip[18][0], w17_w18_ceiling];
586
590
  }