summaryrefslogtreecommitdiff
path: root/src/main.cpp
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/main.cpp
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/main.cpp')
-rw-r--r--src/main.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 3678278..d436a20 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -157,6 +157,26 @@ void numbertest1()
157 arg( a.toString() ). 157 arg( a.toString() ).
158 arg( b.toString() ). 158 arg( b.toString() ).
159 arg( (a / b).toString() ); 159 arg( (a / b).toString() );
160
161 a = "12345";
162 b = "45";
163
164 println("%1 / %2 = %3").
165 arg( a.toString() ).
166 arg( b.toString() ).
167 arg( (a / b).toString() );
168
169 a = "3007103450821050020096034077958224700";
170 b = "898239467";
171
172 println("%1 / %2 = %3").
173 arg( a.toString() ).
174 arg( b.toString() ).
175 arg( (a / b).toString() );
176 println("%1 %% %2 = %3").
177 arg( a.toString() ).
178 arg( b.toString() ).
179 arg( (a % b).toString() );
160} 180}
161 181
162#define compcheck( anum, op, bnum ) \ 182#define compcheck( anum, op, bnum ) \
@@ -230,8 +250,8 @@ int main( int , char *[] )
230 println("CliC"); 250 println("CliC");
231 251
232// packedtest1(); 252// packedtest1();
233// numbertest1(); 253 numbertest1();
234 numbertestcomp(); 254// numbertestcomp();
235 255
236 return 0; 256 return 0;
237} 257}