pow function included

This commit is contained in:
dwarning 2007-11-25 20:00:30 +00:00
parent f58abc51e9
commit 140b5d5e28
5 changed files with 16 additions and 30 deletions

View File

@ -136,7 +136,7 @@ Type(Pchar, char AT)
#define Str(n,a) char a[n+3]={0,0,(char)n} /* n<255 ! */
#define Sini(s) sini(s,sizeof(s)-4)
Cconst(Maxstr,15000) /* was 255, string maxlen, may be up to 32000 or so */
Cconst(Maxstr,25004) /* was 255, string maxlen, may be up to 32000 or so */
typedef char string[258];

View File

@ -5,15 +5,11 @@
* $Id$
*/
#ifdef __TURBOC__
extern unsigned _stklen= 32000; /* Turbo C default was only 4 K */
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
/* #include <math.h> -- ceil floor */
#include <math.h> /* -- ceil floor */
#include "config.h"
#ifdef HAS_WINDOWS
#include "wstdio.h"
@ -593,13 +589,7 @@ Begin
If sz<=0 Then
return Null
Else
#ifdef __TURBOC__
/* truncate to 64 K ! */
If sz> 0xffff Then sz= 0xffff EndIf
p= malloc((Word)sz);
#else
p= malloc(sz);
#endif
If p==Null Then /* fatal error */
ws(" new() failure. Program halted.\n");
exit(1);
@ -738,8 +728,7 @@ Begin
Done
return ok
EndFunc
Intern
Func int posi(Pchar sub, Pchar s, int opt)
/* find position of substring in s */
Begin

View File

@ -28,7 +28,7 @@ Cconst(Llen,15000)
typedef char str50 [54];
typedef char str80 [84];
Cconst(Maxline, 40000) /* size of initial unexpanded circuit code */
Cconst(Maxline, 20000) /* size of initial unexpanded circuit code */
Cconst(Maxckt, 40000) /* size of expanded circuit code */

View File

@ -25,10 +25,6 @@ Todo:
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifdef __TURBOC__
#include <process.h> /* exit() */
#endif
#include "general.h"
#include "numparam.h"
#include "ngspice.h"
@ -36,7 +32,7 @@ Todo:
extern void txfree(void *ptr);
/* Uncomment this line to allow debug tracing */
/*#define TRACE_NUMPARAMS*/
/* #define TRACE_NUMPARAMS */
/* the nupa_signal arguments sent from Spice:
@ -225,7 +221,7 @@ Begin
While alfanum(s[j]) Do
cadd(name, upcase(s[j])); Inc(j)
Done
found= (getidtype(dico, name) == 'U');
found = (getidtype(dico, name) == 'U');
EndIf
Done
If found And (h<ls) Then

View File

@ -14,7 +14,7 @@
/************ keywords ************/
/* SJB - 150 chars is ample for this - see initkeys() */
Intern Str(150, keys); /*all my keywords*/
Intern Str(150, keys); /* all my keywords */
Intern Str(150, fmath); /* all math functions */
static double
@ -43,7 +43,7 @@ Begin
scopy_up(keys,
"and or not div mod if else end while macro funct defined"
" include for to downto is var");
scopy_up(fmath, "sqr sqrt sin cos exp ln arctan abs pwr max min int log ternary_fcn");
scopy_up(fmath, "sqr sqrt sin cos exp ln arctan abs pow pwr max min int log ternary_fcn");
EndProc
Intern
@ -60,12 +60,12 @@ Begin
Case 6 Is y= ln(x)
Case 7 Is y= atan(x)
Case 8 Is y= fabs(x)
Case 9 Is y= exp( x* ln(fabs(z)))
/* pwr(,): the only one with 2 args */
Case 10 Is y= max( x, z )
Case 11 Is y= min( x, z )
Case 12 Is y= trunc( x )
Case 13 Is y= log(x)
Case 9 Is y= pow(x,z)
Case 10 Is y= exp( x* ln(fabs(z)))
Case 11 Is y= max( x, z )
Case 12 Is y= min( x, z )
Case 13 Is y= trunc( x )
Case 14 Is y= log(x)
Default y=x EndSw
return y
EndFunc
@ -977,7 +977,8 @@ Begin
astronomic=False;
If ax<1e-30 Then
isint=True;
ElsIf ax<32000 Then /*detect integers*/ rx=np_round(x);
ElsIf ax<32000 Then /*detect integers*/
rx=np_round(x);
dx=(x-rx)/ax;
isint=(absf(dx)<1e-6);
EndIf