diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-07-09 14:22:07 +1000 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-07-09 14:22:07 +1000 |
commit | 8040a5fd511912cb2141e46e5ca9eb1ab766133e (patch) | |
tree | 4a0de1a1e9c65f08060eb5b25a0326faf433976a /impl/Complete.hpp | |
parent | 049a16d1b1a683487a0c17014e9f7c477820a132 (diff) |
Fix a few bugs and add a new example system.
Diffstat (limited to 'impl/Complete.hpp')
-rw-r--r-- | impl/Complete.hpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/impl/Complete.hpp b/impl/Complete.hpp index 11f2f83..997fb6e 100644 --- a/impl/Complete.hpp +++ b/impl/Complete.hpp @@ -33,6 +33,9 @@ struct Complete { Complete& operator-=(const Complete& other) { return (*this) = (*this) - other; } + Complete& operator*=(const Complete& other) { + return (*this) = (*this) * other; + } Complete operator-() const { return Complete<T>(- _value, _infinity); @@ -50,13 +53,7 @@ struct Complete { return *this + (- other); } Complete operator*(const Complete& other) const { - if (_infinity) { - return *this; - } else if (other._infinity) { - return other; - } else { - return Complete(_value + other._value, false); - } + return Complete(_value * other._value, (_infinity || other._infinity)); } bool operator!() const { |