This commit is contained in:
rlar 2016-09-04 20:04:30 +02:00
parent 9dcf62e1cd
commit 15f2c67968
5 changed files with 18 additions and 8 deletions

View File

@ -47,6 +47,19 @@ NON-STANDARD FEATURES
#include <math.h>
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
#ifndef M_E
# define M_E 2.7182818284590452354
#endif
#ifndef M_LOG2E
# define M_LOG2E 1.4426950408889634074
#endif
#ifndef M_LOG10E
# define M_LOG10E 0.43429448190325182765
#endif
#if !defined(NAN)
#if defined(_MSC_VER)
/* NAN is not defined in VS 2012 or older */

View File

@ -72,8 +72,8 @@ typedef struct {
#define FTEcabs(d) (((d) < 0.0) ? - (d) : (d))
#define cph(c) (atan2(imagpart(c), (realpart(c))))
#define cmag(c) (hypot(realpart(c), imagpart(c)))
#define radtodeg(c) (cx_degrees ? ((c) / 3.14159265358979323846 * 180) : (c))
#define degtorad(c) (cx_degrees ? ((c) * 3.14159265358979323846 / 180) : (c))
#define radtodeg(c) (cx_degrees ? ((c) * (180 / M_PI)) : (c))
#define degtorad(c) (cx_degrees ? ((c) * (M_PI / 180)) : (c))
#define rcheck(cond, name) if (!(cond)) { \
fprintf(cp_err, "Error: argument out of range for %s\n", name); \
return (NULL); }

View File

@ -4,7 +4,6 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/
#include "ngspice/ngspice.h"
#include "ngspice/numconst.h"
#ifndef HAVE_ERFC
@ -12,7 +11,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
double erfc (double x)
{
double sqrtPi, n, temp1, xSq, sum1, sum2;
sqrtPi = sqrt( PI );
sqrtPi = sqrt( M_PI );
x = ABS( x );
n = 1.0;
xSq = 2.0 * x * x;

View File

@ -1760,7 +1760,7 @@ find_roots(double a1, double a2, double a3, double *x1, double *x2, double *x3)
if (q != 0.0) {
t = atan(sqrt((double)-t)/q);
if (t < 0.0)
t += 3.141592654;
t += M_PI;
t /= 3.0;
x = 2.0 * pow(p, 0.16666667) * cos(t) - a1 / 3.0;
} else {

View File

@ -57,8 +57,6 @@ NON-STANDARD FEATURES
/*=== CONSTANTS ========================*/
#define PI 3.14159265358979323846
#define INT1 1
char *allocation_error = "\n**** Error ****\nSINE: Error allocating sine block storage \n";
@ -216,7 +214,7 @@ cm_sine(ARGS)
center = (output_hi + output_low) / 2;
*phase = *phase1 + freq*(TIME - T(1));
radian = *phase * 2.0 * PI;
radian = *phase * 2.0 * M_PI;
OUTPUT(out) = peak * sin(radian) + center;
PARTIAL(out, cntl_in) = 0;