fix: a zero-width band fires on equality or not at all, and the text now says which
The earlier correction moved the claim rather than fixing it: four places still said the float-equality test "never fires on a real-valued signal", and a +/-1 square is a real-valued signal -- a standalone check against a band of [1, 1] fired 19 times, because `inside` is true at +1 and false at -1, so the signal changes side on every transition. All four now state the measured behaviour: an exact float-equality test against the level, which an ordinary signal never satisfies and a signal sitting at the level satisfies on every transition. Neither answer is a band, which is the reason the second spin is clamped an increment away rather than the detector special-cased -- the same conclusion, now resting on a true premise. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
c8f10f59dc
commit
aa8ec1794a
4 files changed
+18
-9
No files matched your search
+5
-2
@@ -119,8 +119,11 @@ double EventDetector::feed_window(double value, double t) noexcept {
|
||||
if (inside == inside_) return kNoEvent;
|
||||
inside_ = inside;
|
||||
// The event is the *change of side*, so `Rising` reads as "into the band" and `Falling`
|
||||
// as "out of it". A band of zero width reduces the condition to an equality test on a
|
||||
// real-valued signal, which is a float-equality test and therefore unusable: the panel refuses one.
|
||||
// as "out of it". A band of zero width is not a band: `inside` reduces to an exact
|
||||
// float-equality test against the level, so the condition fires on none of an ordinary
|
||||
// signal's samples and on every transition of one that sits exactly at the level -- a
|
||||
// +/-1 square against a band of [1, 1] fired 19 times in a standalone check. Neither
|
||||
// answer is a band, so the panel refuses one.
|
||||
const bool fired = (cond_.edge == TriggerEdge::Rising && inside) ||
|
||||
(cond_.edge == TriggerEdge::Falling && !inside) ||
|
||||
cond_.edge == TriggerEdge::Both;
|
||||
|
||||
Reference in new issue
Block a user