From 8040a5fd511912cb2141e46e5ca9eb1ab766133e Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Mon, 9 Jul 2012 14:22:07 +1000 Subject: Fix a few bugs and add a new example system. --- impl/Complete.hpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'impl/Complete.hpp') 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(- _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 { -- cgit v1.2.3