ptfuncs.c bugs (2)


To ng-spice-devel@ieee.ing.uniroma1.it
From "GLAO S. Dezai" <dezai@hotbot.com>
Date Tue, 28 Mar 2000 05:21:19 -0800
Delivered-To mailing list ng-spice-devel@ieee.ing.uniroma1.it
Mailing-List contact ng-spice-devel-help@ieee.ing.uniroma1.it; run by ezmlm
Organization HotBot Mail (http://mail.hotbot.com:80)
Reply-To ng-spice-devel@ieee.ing.uniroma1.it

 
A small error has been forgotten in my previous patches. The arguments of ln 
and log must be strictly positive and the argument of sqrt positive or null.



*****original  routines *****

double
PTln(arg)
    double arg;
{
--    if (arg < 0.0)
--      arg = -arg;
    return (log(arg));
}

double
PTlog(arg)
    double arg;
{
--    if (arg < 0.0)
--      arg = -arg;
    return (log10(arg));
}

double
PTsqrt(arg)
    double arg;
{
    if (arg < 0.0)
--      arg = -arg;
    return (sqrt(arg));
}

*****************************

***** My patches        *****

double
PTln(arg)
    double arg;
{
++    if (arg <= 0.0)
++      return (SHUGE);
    return (log(arg));
}

double
PTlog(arg)
    double arg;
{
++    if (arg <= 0.0)
++      return (SHUGE);
    return (log10(arg));
}


double
PTsqrt(arg)
    double arg;
{
    if (arg < 0.0)
++      return (HUGE);
    return (sqrt(arg));
}

*****************************





Dezai.


HotBot - Search smarter.
http://www.hotbot.com

Partial thread listing: