To | ng-spice-devel@ieee.ing.uniroma1.it |
From | "GLAO S. Dezai" <dezai@hotbot.com> |
Date | Tue, 28 Mar 2000 05:14:24 -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 |
Hi all! I dont know why some functions of the parse tree are coded like that. It seems for me that there is a mistake. It is clear that for the ln function and the log function the zero value of argument is not correctly handled and makes the simulator to crash. But what is not clear is why the sign of argument are changed when they are negative. I suggest that the functions returns HUGE if the arguments are out of range. A huge value returned is correctly handled by the evaluation routine of the parse tree and will generate an error. Devellopers, can you tell me what you think about this. *****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