Browse Source

Fix a bug reported by Thomas Hoffmann in ngspice-users discussion,

2023-02-18.  Incorrect tests were used to detect a crossing in the
first two data samples.
pre-master-46
Giles Atkinson 3 years ago
committed by Holger Vogt
parent
commit
d9b52eb3e1
  1. 10
      src/frontend/com_measure2.c

10
src/frontend/com_measure2.c

@ -491,14 +491,13 @@ com_measure_when(
crossCnt = 0; crossCnt = 0;
if (value < value2) { if (value < value2) {
section = S_BELOW_VAL; section = S_BELOW_VAL;
if ((prevValue <= value2) && (value >= value2)) {
if (prevValue >= prevValue2) {
fallCnt = 1; fallCnt = 1;
crossCnt = 1; crossCnt = 1;
} }
} else { } else {
section = S_ABOVE_VAL; section = S_ABOVE_VAL;
if ((prevValue <= value2) && (value >= value2)) {
if (prevValue < prevValue2) {
riseCnt = 1; riseCnt = 1;
crossCnt = 1; crossCnt = 1;
} }
@ -509,14 +508,13 @@ com_measure_when(
crossCnt = 0; crossCnt = 0;
if (value < meas->m_val) { if (value < meas->m_val) {
section = S_BELOW_VAL; section = S_BELOW_VAL;
if ((prevValue <= meas->m_val) && (value >= meas->m_val)) {
if (prevValue >= meas->m_val) {
fallCnt = 1; fallCnt = 1;
crossCnt = 1; crossCnt = 1;
} }
} else { } else {
section = S_ABOVE_VAL; section = S_ABOVE_VAL;
if ((prevValue <= meas->m_val) && (value >= meas->m_val)) {
if (prevValue < meas->m_val) {
riseCnt = 1; riseCnt = 1;
crossCnt = 1; crossCnt = 1;
} }

Loading…
Cancel
Save