URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 297 |
Rev 384 |
extern double fabs (double);
|
extern double fabs (double);
|
extern double sqrt (double);
|
extern double sqrt (double);
|
|
|
typedef struct complexm {
|
typedef struct complexm {
|
double re,im;
|
double re,im;
|
} complex;
|
} complex;
|
|
|
static complex
|
static complex
|
setCom (double r, double i)
|
setCom (double r, double i)
|
{
|
{
|
complex ct;
|
complex ct;
|
ct.re=fabs(r)<1E-300?0.0:r;
|
ct.re=fabs(r)<1E-300?0.0:r;
|
ct.im=fabs(i)<1E-300?0.0:i;
|
ct.im=fabs(i)<1E-300?0.0:i;
|
return ct;
|
return ct;
|
}
|
}
|
|
|
static complex
|
static complex
|
csqrt_crash (double x)
|
csqrt_crash (double x)
|
{
|
{
|
return (x>=0) ? setCom(sqrt(x),0) : setCom(0,sqrt(-x));
|
return (x>=0) ? setCom(sqrt(x),0) : setCom(0,sqrt(-x));
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.