make operator functions const
This commit is contained in:
parent
e16cfcd0c5
commit
b38a2aae20
@ -43,7 +43,7 @@ void Graphics::plot(const Vec2bf &from, const Vec2bf &to)
|
|||||||
{
|
{
|
||||||
for (double i = 0.0; i < this->w; i++) {
|
for (double i = 0.0; i < this->w; i++) {
|
||||||
for (double j = 0.0; j < this->h; j++) {
|
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
12
utils.h
@ -45,7 +45,7 @@ public:
|
|||||||
std::string to_str();
|
std::string to_str();
|
||||||
BigFloat operator / (const BigFloat &f);
|
BigFloat operator / (const BigFloat &f);
|
||||||
|
|
||||||
inline BigFloat operator - (const BigFloat &f)
|
inline BigFloat operator - (const BigFloat &f) const
|
||||||
{
|
{
|
||||||
BigFloat res = BigFloat(f.precision);
|
BigFloat res = BigFloat(f.precision);
|
||||||
mpfr_sub(res.val, this->val, f.val, MPFR_RNDD);
|
mpfr_sub(res.val, this->val, f.val, MPFR_RNDD);
|
||||||
@ -53,7 +53,7 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline BigFloat operator - (const double d)
|
inline BigFloat operator - (const double d) const
|
||||||
{
|
{
|
||||||
BigFloat res = BigFloat(this->precision);
|
BigFloat res = BigFloat(this->precision);
|
||||||
mpfr_sub_d(res.val, this->val, d, MPFR_RNDD);
|
mpfr_sub_d(res.val, this->val, d, MPFR_RNDD);
|
||||||
@ -61,7 +61,7 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline BigFloat operator * (const BigFloat &f)
|
inline BigFloat operator * (const BigFloat &f) const
|
||||||
{
|
{
|
||||||
BigFloat res = BigFloat(f.precision);
|
BigFloat res = BigFloat(f.precision);
|
||||||
mpfr_mul(res.val, this->val, f.val, MPFR_RNDD);
|
mpfr_mul(res.val, this->val, f.val, MPFR_RNDD);
|
||||||
@ -69,7 +69,7 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline BigFloat operator * (const double d)
|
inline BigFloat operator * (const double d) const
|
||||||
{
|
{
|
||||||
BigFloat res = BigFloat(this->precision);
|
BigFloat res = BigFloat(this->precision);
|
||||||
mpfr_mul_d(res.val, this->val, d, MPFR_RNDD);
|
mpfr_mul_d(res.val, this->val, d, MPFR_RNDD);
|
||||||
@ -77,7 +77,7 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline BigFloat operator + (const BigFloat &f)
|
inline BigFloat operator + (const BigFloat &f) const
|
||||||
{
|
{
|
||||||
BigFloat res = BigFloat(f.precision);
|
BigFloat res = BigFloat(f.precision);
|
||||||
mpfr_add(res.val, this->val, f.val, MPFR_RNDD);
|
mpfr_add(res.val, this->val, f.val, MPFR_RNDD);
|
||||||
@ -85,7 +85,7 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline BigFloat operator + (const double d)
|
inline BigFloat operator + (const double d) const
|
||||||
{
|
{
|
||||||
BigFloat res = BigFloat(this->precision);
|
BigFloat res = BigFloat(this->precision);
|
||||||
mpfr_add_d(res.val, this->val, d, MPFR_RNDD);
|
mpfr_add_d(res.val, this->val, d, MPFR_RNDD);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user