mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 05:47:42 +02:00
PSS Fix: thanks to Marcel Hendrix, a possible bug has been found for division by 0
This commit is contained in:
@@ -744,7 +744,11 @@ DCpss(CKTcircuit *ckt,
|
|||||||
{
|
{
|
||||||
/* Pitagora ha sempre ragione!!! :))) */
|
/* Pitagora ha sempre ragione!!! :))) */
|
||||||
/* pred is treated as FREQUENCY to avoid numerical overflow when derivative is close to ZERO */
|
/* pred is treated as FREQUENCY to avoid numerical overflow when derivative is close to ZERO */
|
||||||
pred [i] = RHS_derivative [i] / err_conv [i] ;
|
if ((RHS_derivative [i] != 0) && (err_conv [i] == 0)) {
|
||||||
|
pred [i] = DBL_MAX ;
|
||||||
|
} else {
|
||||||
|
pred [i] = RHS_derivative [i] / err_conv [i] ;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef STEPDEBUG
|
#ifdef STEPDEBUG
|
||||||
fprintf (stderr, "Pred is so high or so low! Diff is: %g\n", err_conv [i]) ;
|
fprintf (stderr, "Pred is so high or so low! Diff is: %g\n", err_conv [i]) ;
|
||||||
|
|||||||
Reference in New Issue
Block a user