From eacda9f5b4471a6b4a5b3e00ad752ed9e822f9ab Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 7 Aug 2026 15:51:57 +0200 Subject: [PATCH] Updating the step equaliser, especially at the final time TSTOP --- src/spicelib/analysis/dctran.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/spicelib/analysis/dctran.c b/src/spicelib/analysis/dctran.c index 083986231..cc6e933db 100644 --- a/src/spicelib/analysis/dctran.c +++ b/src/spicelib/analysis/dctran.c @@ -587,15 +587,15 @@ resume: } /* Try to equalise the last two time steps before the breakpoint, if the second step would be smaller than CKTdelta otherwise.*/ - else if (!(ckt->CKTbreaks[0] == ckt->CKTfinalTime) && ckt->CKTtime + 1.9 * ckt->CKTdelta > ckt->CKTbreaks[0]) { + else if (!AlmostEqualUlps(ckt->CKTtime + ckt->CKTdelta, ckt->CKTfinalTime, 100) + && ckt->CKTtime + 1.9 * ckt->CKTdelta > ckt->CKTbreaks[0]) { ckt->CKTsaveDelta = ckt->CKTdelta; - ckt->CKTdelta = (ckt->CKTbreaks[0] - ckt->CKTtime) / 2.; + ckt->CKTdelta = (ckt->CKTbreaks[0] - ckt->CKTtime) / 2.0; #ifdef STEPDEBUG - fprintf(stdout, "Delta equalising step at time %e with delta %e and breakpoint at %e\n", - ckt->CKTtime, ckt->CKTdelta, ckt->CKTbreaks[0]); + fprintf(stdout, "Delta equalising step at time %e with new delta %e,\n remaining time %e and breakpoint at %e\n", + ckt->CKTtime, ckt->CKTdelta, ckt->CKTbreaks[0] - ckt->CKTtime, ckt->CKTbreaks[0]); #endif } - #ifdef SHARED_MODULE /* Either directly go to next time step, or modify ckt->CKTdelta depending on synchronization requirements. sharedsync() returns 0. */