⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptfunctions.c

📁 支持数字元件仿真的SPICE插件
💻 C
字号:
/* RCS Info: $Revision: 1.1 $ on $Date: 91/04/02 11:57:19 $ *           $Source: //pepper/atesse_spice/spice3/INP/RCS/PTfunctions.c,v $ * Copyright (c) 1987 Wayne A. Christopher, U. C. Berkeley CAD Group  *   faustus@cad.berkeley.edu, ucbvax!faustus * Permission is granted to modify and re-distribute this code in any manner * as long as this notice is preserved.  All standard disclaimers apply. * * All the functions used in the parse tree.  These functions return HUGE * if their argument is out of range. */#include "prefix.h"#include <stdio.h>#include <math.h>#include "IFsim.h"#ifndef CMS#include "INPparseTree.h"#else  /* CMS */#include "INPparse.h"#endif /* CMS */#include "suffix.h"RCSID("PTfunctions.c $Revision: 1.1 $ on $Date: 91/04/02 11:57:19 $")#define PI 3.14159265358979323846/* These should be in math.h */#ifdef HASATRIGHextern double asinh(), acosh(), atanh();#endif /* HASATRIGH *//* Reduce the argument to be within the range 0 - 2 pi.  This is necessary * because the trig functions are broken. */static doublereduce(arg)    double arg;{    int i = arg / PI;    return (arg - i * PI);}doublePTplus(arg1, arg2)    double arg1, arg2;{    return (arg1 + arg2);}doublePTminus(arg1, arg2)    double arg1, arg2;{    return (arg1 - arg2);}doublePTtimes(arg1, arg2)    double arg1, arg2;{    return (arg1 * arg2);}double PTdivide(arg1, arg2)    double arg1, arg2;{    if (arg2 == 0)        return (HUGE);    return (arg1 / arg2);}doublePTpower(arg1, arg2)    double arg1, arg2;{    return (pow(arg1, arg2));}doublePTacos(arg)    double arg;{    return (acos(arg));}#ifdef HASATRIGHdoublePTacosh(arg)    double arg;{    return (acosh(arg));}#endif /* HASATRIGH */doublePTasin(arg)    double arg;{    return (asin(arg));}#ifdef HASATRIGHdoublePTasinh(arg)    double arg;{    return (asinh(arg));}#endif /* HASATRIGH */doublePTatan(arg)    double arg;{    return (atan(arg));}#ifdef HASATRIGHdoublePTatanh(arg)    double arg;{    return (atanh(arg));}#endif /* HASATRIGH */doublePTcos(arg)    double arg;{    return (cos(reduce(arg)));}doublePTcosh(arg)    double arg;{    return (cosh(arg));}doublePTexp(arg)    double arg;{    return (exp(arg));}doublePTln(arg)    double arg;{    return (log(arg));}doublePTlog(arg)    double arg;{    return (log10(arg));}doublePTsin(arg)    double arg;{    return (sin(reduce(arg)));}doublePTsinh(arg)    double arg;{    return (sinh(arg));}doublePTsqrt(arg)    double arg;{    return (sqrt(arg));}doublePTtan(arg)    double arg;{    return (tan(reduce(arg)));}doublePTtanh(arg)    double arg;{    return (tanh(arg));}doublePTuminus(arg)    double arg;{    return (- arg);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -