2008-05-11 22:27:28 +02:00
|
|
|
/**********
|
|
|
|
|
Copyright 1991 Regents of the University of California. All rights reserved.
|
|
|
|
|
**********/
|
|
|
|
|
|
|
|
|
|
#include "ngspice.h"
|
|
|
|
|
|
2008-11-19 20:57:27 +01:00
|
|
|
#ifndef HAVE_SCALBN
|
2008-05-11 22:27:28 +02:00
|
|
|
|
|
|
|
|
double
|
2008-11-19 20:57:27 +01:00
|
|
|
scalbn(double x, int n)
|
2008-05-11 22:27:28 +02:00
|
|
|
{
|
|
|
|
|
double y, z = 1.0, k = 2.0;
|
|
|
|
|
|
|
|
|
|
if (n < 0) {
|
|
|
|
|
n = -n;
|
|
|
|
|
k = 0.5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x != 0.0)
|
|
|
|
|
for (y = 1.0; n; n >>= 1) {
|
|
|
|
|
y *= k;
|
|
|
|
|
if (n & 1)
|
|
|
|
|
z *= y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return x * z;
|
|
|
|
|
}
|
2008-11-19 20:57:27 +01:00
|
|
|
|
|
|
|
|
#else /* HAVE_SCALBN */
|
|
|
|
|
|
|
|
|
|
int Dummy_Symbol_1;
|
|
|
|
|
|
|
|
|
|
#endif /* HAVE_SCALBN */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_SCALB
|
|
|
|
|
|
|
|
|
|
double
|
|
|
|
|
scalb(double x, double n)
|
2008-09-24 00:10:56 +02:00
|
|
|
{
|
2008-11-19 20:57:27 +01:00
|
|
|
return scalbn(x, (int) n);
|
2008-09-24 00:10:56 +02:00
|
|
|
}
|
2008-11-19 20:57:27 +01:00
|
|
|
|
|
|
|
|
#else /* HAVE_SCALB */
|
|
|
|
|
|
|
|
|
|
int Dummy_Symbol_2;
|
|
|
|
|
|
2008-05-11 22:27:28 +02:00
|
|
|
#endif /* HAVE_SCALB */
|