diff --git a/src/include/ngspice/missing_math.h b/src/include/ngspice/missing_math.h index 4f9e2ee90..75f718f80 100644 --- a/src/include/ngspice/missing_math.h +++ b/src/include/ngspice/missing_math.h @@ -9,10 +9,6 @@ Copyright 1999 Emmanuel Rouat bool AlmostEqualUlps(double, double, int); -#ifndef HAVE_ERFC -extern double erfc(double); -#endif - #ifndef HAVE_LOGB extern double logb(double); #endif diff --git a/src/maths/misc/Makefile.am b/src/maths/misc/Makefile.am index 5f68ef979..960e40209 100644 --- a/src/maths/misc/Makefile.am +++ b/src/maths/misc/Makefile.am @@ -7,7 +7,6 @@ libmathmisc_la_SOURCES = \ accuracy.h \ bernoull.h \ bernoull.c \ - erfc.c \ equality.c \ isinf.c \ isnan.c \ @@ -18,7 +17,7 @@ libmathmisc_la_SOURCES = \ randnumb.c -EXTRA_DIST = test_accuracy.c test_erfc.c +EXTRA_DIST = test_accuracy.c AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include AM_CFLAGS = $(STATIC) diff --git a/src/maths/misc/erfc.c b/src/maths/misc/erfc.c deleted file mode 100644 index 015bae3c7..000000000 --- a/src/maths/misc/erfc.c +++ /dev/null @@ -1,70 +0,0 @@ -/********** -Copyright 1991 Regents of the University of California. All rights reserved. -Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group -**********/ - -#include "ngspice/ngspice.h" - -#ifndef HAVE_ERFC - -/* 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( M_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 ); - } -} - -/* From C. Hastings, Jr., Approximations for digital computers, - Princeton Univ. Press, 1955. - Approximation accurate to within 1.5E-7 - (making some assumptions about your machine's floating point mechanism) -*/ -double -ierfc(double x) -{ - double t, z; - - t = 1/(1 + 0.3275911*x); - z = 1.061405429; - z = -1.453152027 + t * z; - z = 1.421413741 + t * z; - z = -0.284496736 + t * z; - z = 0.254829592 + t * z; - z = exp(-x*x) * t * z; - - return(z); -} - -#else -int Dummy_Symbol_5; -#endif diff --git a/src/maths/misc/test_erfc.c b/src/maths/misc/test_erfc.c deleted file mode 100644 index d4d760111..000000000 --- a/src/maths/misc/test_erfc.c +++ /dev/null @@ -1,105 +0,0 @@ -/* Paolo Nenzi 2002 - This program tests erfc function - * implementations. - */ - - -/* - * The situation on erfc functions in spice/cider: - * - * First we have the ierfc in spice, a sort of interpolation, which is - * fast to compute but gives is not so "good" - * Then we have derfc from cider, which is accurate but slow, the code is from sedan's derfc.f . - * Both above are only valid for x > 0.0 - * Then we have glibc/os specific implementation. - * - * Proposal: - * - * Use glibc/os specific implementation as default and then test cider one. - */ - - -#include -#include -#include -#ifdef HAVE_FPU_CTRL -#include -#endif - - -double -derfc(double x) -{ - double sqrtPi, n, temp1, xSq, sum1, sum2; - sqrtPi = sqrt( M_PI ); - x = fabs( x ); /* only x > 0 interested */ - 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 ); - } -} - -double -ierfc(double x) -{ - double t, z; - - t = 1/(1 + 0.3275911*x); - z = 1.061405429; - z = -1.453152027 + t * z; - z = 1.421413741 + t * z; - z = -0.284496736 + t * z; - z = 0.254829592 + t * z; - z = exp(-x*x) * t * z; - - return(z); -} - - - -int main (void) -{ - double x = -30.0; - double y1= 0.0, y2 = 0.0; - -#ifdef HAVE_FPU_CTRL - fpu_control_t prec; - _FPU_GETCW(prec); - prec &= ~_FPU_EXTENDED; - prec |= _FPU_DOUBLE; - _FPU_SETCW(prec); -#endif - -for (;(x <= 30.0);) - { - y1 = ierfc(x); - y2 = derfc(x); - printf("x: %f \t ierfc: %e \t derfc: %e \t erfc: %e\n", x, y1, y2, erfc(x) ); - x = x + 1.0; - } - exit(1); -} diff --git a/visualc/sharedspice.vcxproj b/visualc/sharedspice.vcxproj index 29d09acf6..900cedad9 100644 --- a/visualc/sharedspice.vcxproj +++ b/visualc/sharedspice.vcxproj @@ -1101,7 +1101,6 @@ - diff --git a/visualc/src/include/ngspice/config.h b/visualc/src/include/ngspice/config.h index 92fae2e8f..642023e90 100644 --- a/visualc/src/include/ngspice/config.h +++ b/visualc/src/include/ngspice/config.h @@ -120,9 +120,6 @@ /* Define to 1 if you have the `endpwent' function. */ /* #undef HAVE_ENDPWENT */ -/* Define to 1 if you have the `erfc' function. */ -#define HAVE_ERFC 1 - /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 diff --git a/visualc/vngspice-fftw.vcxproj b/visualc/vngspice-fftw.vcxproj index 268258855..6f82f8ab6 100644 --- a/visualc/vngspice-fftw.vcxproj +++ b/visualc/vngspice-fftw.vcxproj @@ -1540,7 +1540,6 @@ lib /machine:x64 /def:..\..\fftw-3.3.4-dll64\libfftw3-3.def /out:$(IntDir)libfft - diff --git a/visualc/vngspice.vcxproj b/visualc/vngspice.vcxproj index c87d4ad05..0474d6015 100644 --- a/visualc/vngspice.vcxproj +++ b/visualc/vngspice.vcxproj @@ -1506,7 +1506,6 @@ -