Add exact-zero guards in various classes to prevent division by zero errors

This commit is contained in:
Miha Kralj
2026-02-16 21:57:11 -08:00
parent 63ae2c9ab2
commit b63b9730e1
10 changed files with 18 additions and 2 deletions
+2
View File
@@ -329,6 +329,7 @@ public sealed class Bbs : ITValuePublisher
_prevSqueezeOn = squeezeOn;
// === Bandwidth ===
// skipcq: CS-R1077 - Exact-zero guard: bbMean is a price average; zero means no data, not rounding artifact
double bandwidth = bbMean != 0.0 ? ((bbUpper - bbLower) / bbMean) * 100.0 : 0.0;
// === Resync for floating-point drift ===
@@ -611,6 +612,7 @@ public sealed class Bbs : ITValuePublisher
squeezeOn[i] = bbUpper < kcUpper && bbLower > kcLower;
// Bandwidth
// skipcq: CS-R1077 - Exact-zero guard: bbMean is a price average; zero means no data, not rounding artifact
bandwidth[i] = bbMean != 0.0 ? ((bbUpper - bbLower) / bbMean) * 100.0 : 0.0;
}
}