make operator functions const

This commit is contained in:
Akos Horvath 2022-07-04 19:53:32 +02:00
parent e16cfcd0c5
commit b38a2aae20
2 changed files with 7 additions and 7 deletions

View File

@ -43,7 +43,7 @@ void Graphics::plot(const Vec2bf &from, const Vec2bf &to)
{
for (double i = 0.0; i < this->w; i++) {
for (double j = 0.0; j < this->h; j++) {
BigFloat f = from.x + (i / this->w) * (from.x - to.x);
BigFloat f = (from.x - to.x) * from.x + (i / this->w);
}
}
}

12
utils.h
View File

@ -45,7 +45,7 @@ public:
std::string to_str();
BigFloat operator / (const BigFloat &f);
inline BigFloat operator - (const BigFloat &f)
inline BigFloat operator - (const BigFloat &f) const
{
BigFloat res = BigFloat(f.precision);
mpfr_sub(res.val, this->val, f.val, MPFR_RNDD);
@ -53,7 +53,7 @@ public:
return res;
}
inline BigFloat operator - (const double d)
inline BigFloat operator - (const double d) const
{
BigFloat res = BigFloat(this->precision);
mpfr_sub_d(res.val, this->val, d, MPFR_RNDD);
@ -61,7 +61,7 @@ public:
return res;
}
inline BigFloat operator * (const BigFloat &f)
inline BigFloat operator * (const BigFloat &f) const
{
BigFloat res = BigFloat(f.precision);
mpfr_mul(res.val, this->val, f.val, MPFR_RNDD);
@ -69,7 +69,7 @@ public:
return res;
}
inline BigFloat operator * (const double d)
inline BigFloat operator * (const double d) const
{
BigFloat res = BigFloat(this->precision);
mpfr_mul_d(res.val, this->val, d, MPFR_RNDD);
@ -77,7 +77,7 @@ public:
return res;
}
inline BigFloat operator + (const BigFloat &f)
inline BigFloat operator + (const BigFloat &f) const
{
BigFloat res = BigFloat(f.precision);
mpfr_add(res.val, this->val, f.val, MPFR_RNDD);
@ -85,7 +85,7 @@ public:
return res;
}
inline BigFloat operator + (const double d)
inline BigFloat operator + (const double d) const
{
BigFloat res = BigFloat(this->precision);
mpfr_add_d(res.val, this->val, d, MPFR_RNDD);