summaryrefslogtreecommitdiff
path: root/src/number.h
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2013-04-16 13:57:57 -0600
committerMike Buland <mike@xagasoft.com>2013-04-16 13:57:57 -0600
commit7bb55b03c393b5d00914d328a16d238d17f6aa0f (patch)
tree4d9a0547b105e1867f8118f2f00548e1e05589ad /src/number.h
parent25989c6d3911b1d29a5866e668bff52537893afb (diff)
downloadclic-7bb55b03c393b5d00914d328a16d238d17f6aa0f.tar.gz
clic-7bb55b03c393b5d00914d328a16d238d17f6aa0f.tar.bz2
clic-7bb55b03c393b5d00914d328a16d238d17f6aa0f.tar.xz
clic-7bb55b03c393b5d00914d328a16d238d17f6aa0f.zip
Added /, %, and = operators.
Division now works just fine, but by long division. There are apparently much faster ways of doing division, but as long as it works I feel like that's a great start :)
Diffstat (limited to 'src/number.h')
-rw-r--r--src/number.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/number.h b/src/number.h
index 7d65096..9cb16b0 100644
--- a/src/number.h
+++ b/src/number.h
@@ -12,11 +12,13 @@ public:
12 virtual ~Number(); 12 virtual ~Number();
13 13
14 Number &operator=( const Bu::String &sNum ); 14 Number &operator=( const Bu::String &sNum );
15 Number &operator=( const Number &rhs );
15 16
16 Number operator+( const Number &rhs ) const; 17 Number operator+( const Number &rhs ) const;
17 Number operator-( const Number &rhs ) const; 18 Number operator-( const Number &rhs ) const;
18 Number operator*( const Number &rhs ) const; 19 Number operator*( const Number &rhs ) const;
19 Number operator/( const Number &rhs ) const; 20 Number operator/( const Number &rhs ) const;
21 Number operator%( const Number &rhs ) const;
20 Number operator-() const; 22 Number operator-() const;
21 23
22 bool operator==( const Number &rhs ) const; 24 bool operator==( const Number &rhs ) const;
@@ -27,6 +29,7 @@ public:
27 bool operator<=( const Number &rhs ) const; 29 bool operator<=( const Number &rhs ) const;
28 30
29 void set( const Bu::String &sNum ); 31 void set( const Bu::String &sNum );
32 void set( const Number &sNum );
30 33
31 operator Bu::String() const 34 operator Bu::String() const
32 { 35 {
@@ -39,6 +42,7 @@ public:
39 42
40private: 43private:
41 Number add( const Number &rhs, bool bSub ) const; 44 Number add( const Number &rhs, bool bSub ) const;
45 void divide( const Number &rhs, Number &q, Number &r ) const;
42 46
43private: 47private:
44 int iOrd; 48 int iOrd;