[CodeFactor] Apply fixes to commit 9697fac

This commit is contained in:
codefactor-io
2026-03-14 05:03:08 +00:00
parent 9697facfb4
commit e35ff7fa3f
164 changed files with 458 additions and 530 deletions
+2 -2
View File
@@ -222,7 +222,7 @@ public sealed class Trendflex : AbstractBase
// Always use Add (not UpdateNewest) because Snapshot/Restore already handles rollback
buf.Add(filt);
int n = Math.Min(s.Count, period);
double slopeSum = n > 0 ? (n * filt - buf.Sum) / period : 0.0;
double slopeSum = n > 0 ? ((n * filt) - buf.Sum) / period : 0.0;
// --- RMS normalization ---
s.Ms = Math.FusedMultiplyAdd(RMS_ALPHA, slopeSum * slopeSum, RMS_DECAY * s.Ms);
@@ -272,7 +272,7 @@ public sealed class Trendflex : AbstractBase
// Slope
buf.Add(filt);
int n = Math.Min(s.Count, period);
double slopeSum = n > 0 ? (n * filt - buf.Sum) / period : 0.0;
double slopeSum = n > 0 ? ((n * filt) - buf.Sum) / period : 0.0;
// RMS
s.Ms = Math.FusedMultiplyAdd(RMS_ALPHA, slopeSum * slopeSum, RMS_DECAY * s.Ms);