ts-fsrs 5.3.1 → 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.umd.js CHANGED
@@ -511,7 +511,7 @@
511
511
  return prng;
512
512
  }
513
513
 
514
- const version="5.3.1";
514
+ const version="5.3.3";
515
515
 
516
516
  const default_request_retention = 0.9;
517
517
  const default_maximum_interval = 36500;
@@ -582,15 +582,19 @@
582
582
  ];
583
583
 
584
584
  const clipParameters = (parameters, numRelearningSteps, enableShortTerm = default_enable_short_term) => {
585
- let w17_w18_ceiling = W17_W18_Ceiling;
586
- if (Math.max(0, numRelearningSteps) > 1) {
587
- const value = -(Math.log(parameters[11]) + Math.log(Math.pow(2, parameters[13]) - 1) + parameters[14] * 0.3) / numRelearningSteps;
588
- w17_w18_ceiling = clamp(+value.toFixed(8), 0.01, 2);
589
- }
590
- const clip = CLAMP_PARAMETERS(w17_w18_ceiling, enableShortTerm).slice(
585
+ const clip = CLAMP_PARAMETERS(W17_W18_Ceiling, enableShortTerm).slice(
591
586
  0,
592
587
  parameters.length
593
588
  );
589
+ if (Math.max(0, numRelearningSteps) > 1) {
590
+ const w11 = clamp(parameters[11] || 0, clip[11][0], clip[11][1]);
591
+ const w13 = clamp(parameters[13] || 0, clip[13][0], clip[13][1]);
592
+ const w14 = clamp(parameters[14] || 0, clip[14][0], clip[14][1]);
593
+ const value = -(Math.log(w11) + Math.log(Math.pow(2, w13) - 1) + w14 * 0.3) / numRelearningSteps;
594
+ const w17_w18_ceiling = clamp(roundTo(value, 8), 0.01, W17_W18_Ceiling);
595
+ if (clip[17]) clip[17] = [clip[17][0], w17_w18_ceiling];
596
+ if (clip[18]) clip[18] = [clip[18][0], w17_w18_ceiling];
597
+ }
594
598
  return clip.map(
595
599
  ([min, max], index) => clamp(parameters[index] || 0, min, max)
596
600
  );