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/dist/index.mjs CHANGED
@@ -481,7 +481,7 @@ function alea(seed) {
481
481
  return prng;
482
482
  }
483
483
 
484
- const version="5.3.2";
484
+ const version="5.3.3";
485
485
 
486
486
  const default_request_retention = 0.9;
487
487
  const default_maximum_interval = 36500;
@@ -552,15 +552,19 @@ const CLAMP_PARAMETERS = (w17_w18_ceiling, enable_short_term = default_enable_sh
552
552
  ];
553
553
 
554
554
  const clipParameters = (parameters, numRelearningSteps, enableShortTerm = default_enable_short_term) => {
555
- let w17_w18_ceiling = W17_W18_Ceiling;
556
- if (Math.max(0, numRelearningSteps) > 1) {
557
- const value = -(Math.log(parameters[11]) + Math.log(Math.pow(2, parameters[13]) - 1) + parameters[14] * 0.3) / numRelearningSteps;
558
- w17_w18_ceiling = clamp(+value.toFixed(8), 0.01, 2);
559
- }
560
- const clip = CLAMP_PARAMETERS(w17_w18_ceiling, enableShortTerm).slice(
555
+ const clip = CLAMP_PARAMETERS(W17_W18_Ceiling, enableShortTerm).slice(
561
556
  0,
562
557
  parameters.length
563
558
  );
559
+ if (Math.max(0, numRelearningSteps) > 1) {
560
+ const w11 = clamp(parameters[11] || 0, clip[11][0], clip[11][1]);
561
+ const w13 = clamp(parameters[13] || 0, clip[13][0], clip[13][1]);
562
+ const w14 = clamp(parameters[14] || 0, clip[14][0], clip[14][1]);
563
+ const value = -(Math.log(w11) + Math.log(Math.pow(2, w13) - 1) + w14 * 0.3) / numRelearningSteps;
564
+ const w17_w18_ceiling = clamp(roundTo(value, 8), 0.01, W17_W18_Ceiling);
565
+ if (clip[17]) clip[17] = [clip[17][0], w17_w18_ceiling];
566
+ if (clip[18]) clip[18] = [clip[18][0], w17_w18_ceiling];
567
+ }
564
568
  return clip.map(
565
569
  ([min, max], index) => clamp(parameters[index] || 0, min, max)
566
570
  );