fix warnings identified by clang

This commit is contained in:
Erik M. Bray 2020-02-11 11:38:13 +00:00
parent 0f5d13e59f
commit 91835d1728
7 changed files with 27 additions and 11 deletions

View File

@ -73,7 +73,7 @@ template <class T>
std::ostream & operator<< (std::ostream &output, const Polynomial<T> &op) {
int allZero = 1;
for (int i=0; i<=op.degree; ++i)
for (int j=0; j<=i; ++j){
for (int j=0; j<=i; ++j) {
if (op.coef[i*(i+1)/2 + j] == 0.0) continue;
allZero = 0;
if (op.coef[i*(i+1)/2 + j] == -1.0)
@ -85,26 +85,28 @@ std::ostream & operator<< (std::ostream &output, const Polynomial<T> &op) {
if (i == 0)
if (op.coef[0] == T(1))
output << "1";
if (i != 0)
if (i-j == 0)
if (i != 0) {
if (i-j == 0) {
if (j == 1)
output << "y";
else
output << "y^" << j;
else if (i-j == 1)
} else if (i-j == 1) {
if (j == 0)
output << "x";
else if (j == 1)
output << "x*y";
else
output << "x*y^" << j;
else
} else {
if (j == 0)
output << "x^" << i;
else if (j == 1)
output << "x^" << (i-j) << "*y";
else
output << "x^" << (i-j) << "*y^" << j;
}
}
}
if (allZero) output << "0";
return output;

View File

@ -5,7 +5,9 @@
#include <mpfr.h>
// ACTIVATE ROUND MODE CONTROL
#pragma STDC FENV_ACCESS on
#ifndef __clang__
#pragma STDC FENV_ACCESS ON
#endif
double * homotopyPath (int degree, double *_coef, double _y0R, double _y0I);

View File

@ -8,7 +8,9 @@
// ACTIVATE ROUND MODE CONTROL
#pragma STDC FENV_ACCESS on
#ifndef __clang__
#pragma STDC FENV_ACCESS ON
#endif
typedef std::complex<double> Complex;

View File

@ -5,7 +5,9 @@
#define MIN(a,b) (((a) < (b))? (a) : (b))
#define MAX(a,b) (((a) > (b))? (a) : (b))
#pragma STDC FENV_ACCESS on
#ifndef __clang__
#pragma STDC FENV_ACCESS ON
#endif
// CONSTRUCTORS
@ -386,4 +388,4 @@ double f (double x, double c) {
}
double g (double x, double c) {
return -c / (x*x + c*c);
}
}

View File

@ -5,7 +5,9 @@
// ACTIVATE ROUND MODE CONTROL
#pragma STDC FENV_ACCESS on
#ifndef __clang__
#pragma STDC FENV_ACCESS ON
#endif
// MACROS FOR MIN AND MAX
#define MIN(a,b) (((a) < (b))? (a) : (b))
@ -365,4 +367,4 @@ Interval operator/ (double op1, const Interval &op2) {
// RESTORE OLD ROUNDING MODE
fesetround (oldRound);
return rop;
}
}

View File

@ -80,21 +80,25 @@ MPInterval & MPInterval::operator= (const MPInterval &op) {
// UPDATE VALUES
mpfr_set (this->a, op.a, MPFR_RNDD);
mpfr_set (this->b, op.b, MPFR_RNDU);
return *this;
}
MPInterval & MPInterval::operator= (const Interval &op) {
// UPDATE VALUES
mpfr_set_d (this->a, op.a, MPFR_RNDD);
mpfr_set_d (this->b, op.b, MPFR_RNDU);
return *this;
}
MPInterval & MPInterval::operator= (const mpfr_t op) {
// UPDATE VALUES
mpfr_set (this->a, op, MPFR_RNDD);
mpfr_set (this->b, op, MPFR_RNDU);
return *this;
}
MPInterval & MPInterval::operator= (double op) {
// UPDATE VALUES
mpfr_set_d (this->a, op, MPFR_RNDD);
mpfr_set_d (this->b, op, MPFR_RNDU);
return *this;
}

View File

@ -17,7 +17,9 @@ using namespace std;
// z2 = t(1+0.01i)
******************************************/
#ifndef __clang__
#pragma STDC FENV_ACCESS ON
#endif
// PERFORM A MINIMUM OF 5 ITERATIONS OF NEWTON METHOD TO CORRECT THE APPROXIMATION OF THE ROOT (SUPPOSED TO BE GOOD ENOUGH)
template <>