-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from yashsoni501/main
Added >, <, <=, >= operators along with tests
- Loading branch information
Showing
9 changed files
with
276 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ bool largeInt::operator==(int z) | |
{ | ||
return false; | ||
} | ||
std:: cout << z << std::endl; | ||
|
||
z /= 10; | ||
n--; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include<iostream> | ||
#include<cassert> | ||
#include<random> | ||
#include<bigint.hpp> | ||
|
||
int main() | ||
{ | ||
libbig::largeInt a,b; | ||
|
||
std::random_device rd; // obtain a random number from hardware | ||
std::mt19937 gen(rd()); // seed the generator | ||
std::uniform_int_distribution<> distr(-2147483648, 2147483647); // define the range | ||
|
||
for(int i=0;i<100;i++) | ||
{ | ||
int i1 = distr(gen); | ||
int i2 = distr(gen); | ||
a = i1; | ||
b = i2; | ||
assert((a>=b) == (i1>=i2)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include<iostream> | ||
#include<cassert> | ||
#include<random> | ||
#include<bigint.hpp> | ||
|
||
int main() | ||
{ | ||
libbig::largeInt a,b; | ||
|
||
std::random_device rd; // obtain a random number from hardware | ||
std::mt19937 gen(rd()); // seed the generator | ||
std::uniform_int_distribution<> distr(-2147483648, 2147483647); // define the range | ||
|
||
for(int i=0;i<100;i++) | ||
{ | ||
int i1 = distr(gen); | ||
int i2 = distr(gen); | ||
a = i1; | ||
b = i2; | ||
assert((a>b) == (i1>i2)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include<iostream> | ||
#include<cassert> | ||
#include<random> | ||
#include<bigint.hpp> | ||
|
||
int main() | ||
{ | ||
libbig::largeInt a,b; | ||
|
||
std::random_device rd; // obtain a random number from hardware | ||
std::mt19937 gen(rd()); // seed the generator | ||
std::uniform_int_distribution<> distr(-2147483648, 2147483647); // define the range | ||
|
||
for(int i=0;i<100;i++) | ||
{ | ||
int i1 = distr(gen); | ||
int i2 = distr(gen); | ||
a = i1; | ||
b = i2; | ||
assert((a<=b) == (i1<=i2)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include<iostream> | ||
#include<cassert> | ||
#include<random> | ||
#include<bigint.hpp> | ||
|
||
int main() | ||
{ | ||
libbig::largeInt a,b; | ||
|
||
std::random_device rd; // obtain a random number from hardware | ||
std::mt19937 gen(rd()); // seed the generator | ||
std::uniform_int_distribution<> distr(-2147483648, 2147483647); // define the range | ||
|
||
for(int i=0;i<100;i++) | ||
{ | ||
int i1 = distr(gen); | ||
int i2 = distr(gen); | ||
a = i1; | ||
b = i2; | ||
assert((a<b) == (i1<i2)); | ||
} | ||
} |