Instead of
#define a1 this->get_real()
write
auto const a1 = get_real();
And just use different names for each value of a quantity that changes.
Yes there are cases where a local #define
makes sense. No this is not such a case. In particular, since you've forgotten to #undef
the macros they will almost certainly cause inadvertent text substitution in some other code, if this is in a header (as indicated).
By, the way, instead of
Quaternion Quaternion::operator*(const Quaternion& q){
I would write
Quaternion Quaternion::operator*(const Quaternion& q) const {
so that also const
quaternions can be multiplied.