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

📄 erfc.c

📁 ngspice又一个电子CAD仿真软件代码.功能更全
💻 C
字号:
/**********Copyright 1991 Regents of the University of California.  All rights reserved.Author:	1987 Kartikeya Mayaram, U. C. Berkeley CAD Group**********/#include "ngspice.h"#include "numglobs.h"#include "numconst.h"/* erfc computes the erfc(x) the code is from sedan's derfc.f */double erfc ( double x){    double sqrtPi, n, temp1, xSq, sum1, sum2;    sqrtPi = sqrt( PI );    x = ABS( x );    n = 1.0;    xSq = 2.0 * x * x;    sum1 = 0.0;    if ( x > 3.23 ) {	/* asymptotic expansion */	temp1 = exp( - x * x ) / ( sqrtPi * x );	sum2 = temp1;	while ( sum1 != sum2 ) {	    sum1 = sum2;	    temp1 = -1.0 * ( temp1 / xSq );	    sum2 += temp1;	    n += 2.0;	}	return( sum2 );    }    else {	/* series expansion for small x */	temp1 = ( 2.0 / sqrtPi ) * exp( - x * x ) * x;	sum2 = temp1;	while ( sum1 != sum2 ) {	    n += 2.0;	    sum1 = sum2;	    temp1 *= xSq / n;	    sum2 += temp1;	}        return( 1.0 - sum2 );    }}

⌨️ 快捷键说明

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