Matt McCutchen's Web Site
/
bigint
/
bigint.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Massive cleanup of the entire codebase. Notable changes include:
[bigint/bigint.git]
/
sample.cc
diff --git
a/sample.cc
b/sample.cc
index
0fd9ee4
..
149b18b
100644
(file)
--- a/
sample.cc
+++ b/
sample.cc
@@
-18,8
+18,8
@@
int main() {
BigInteger a; // a is 0
int b = 535;
BigInteger a; // a is 0
int b = 535;
- a = b; // From int to BigInteger...
- b = a
; // ...and back, no casts required!
+ a = b; // From int to BigInteger
implicitly
...
+ b = a
.toInt(); // ...and back explicitly.
/*
* If a were too big for an int you'd get a runtime exception.
* The Big Integer Library throws C-strings (that is,
/*
* If a were too big for an int you'd get a runtime exception.
* The Big Integer Library throws C-strings (that is,
@@
-119,4
+119,4
@@
Running the sample program produces this output:
314^9 = 29673367320587092457984
314^10 = 9317437338664347031806976
314^9 = 29673367320587092457984
314^10 = 9317437338664347031806976
-
*/
+*/