ayaankhan98 / bigINT

Efficient OpenSource Big Integer(Library) Support for C++
Boost Software License 1.0
6 stars 26 forks source link

[feat] operator overloads #4

Open ayaankhan98 opened 4 years ago

ayaankhan98 commented 4 years ago

also include tests for corrosponding operators

Tripathi-Alok commented 4 years ago

what we have to do with these operators?Please Explain

ayaankhan98 commented 4 years ago

@Tripathi-Alok suppose we decalre two large integers like

largeInt a, b;

then in order to take input of these large integers we need to overload the insertion and excertion operators on the largeInt class then only we can write the statement like

cin >> a >> b;

if we do not overload the istream and ostream operators (insertion and excertion operators) then this will create an error. basically for custom types we have to tell the routine to the compiler that in which way the compiler should interpret these operators for custom types.

simlar goes for the other operators like addition, subtraction, etc etc. for example if we have two large integers say

largeInt a("100000000000000000000000000000000000000000000000000000000000000000");
largeInt b("100000000000000000000000000000000000000000000000000000000000000000");

then c++ compiler does not know how to add or subtract these large integers thus, we have to define the routine to tell the compiler how to handle these operations of addition or subraction thus we need to overload the operators on the largeInt class.

hope this makes sense.

Alok-873 commented 4 years ago

Okay can i try on this issue?

Alok-873 commented 4 years ago

I'll try my best but not sure that i can achieve the goal for this question

ayaankhan98 commented 4 years ago

yes sure go ahead!

@Alok-873 please mark the operators on which you are working, it will be easy for others to take up.

Tripathi-Alok commented 4 years ago

Minimum how many operators we can take

ayaankhan98 commented 4 years ago

@Tripathi-Alok you can implement all if you wish.

Tripathi-Alok commented 4 years ago

I would like to work on + - operators

ayaankhan98 commented 4 years ago

@Tripathi-Alok okay go ahead, looking forward for you PR

Tripathi-Alok commented 4 years ago

Sir why Am i getting error regarding Cpmake.txt file?

ayaankhan98 commented 4 years ago

@Tripathi-Alok CMake is a tool used for building the projects, as large projects contains of large number of files so it's not possible to compile each and every file separately into object code and then link them, so we hand over this job to cmake, we specify the CMake configuration in files known as CMakeLists.txt which takes care of building the project.

you can read more about it here

justinbax commented 4 years ago

All the overloads and ctors can take both long long and int64_t as parameters. This won't compile on some platforms where int64_t happens to be a typedef for long long int (for example it doesn't compile on my Windows 10 machine using MinGW-W64 g++ 8.1.0). We should only use long long or int64_t (but long long would be simpler). I'll fix this (I also made some changes in the ostream operator and wrote ctors)

MonarchChakri commented 4 years ago

I am working on < operator

MonarchChakri commented 4 years ago

@ayaankhan98 Created a PR https://github.com/ayaankhan98/bigINT/pull/17 Please review and merge.

sanjay035 commented 4 years ago

I have previously written code for multiplying signed long numeric integer strings, would like to contribute to the multiply '*' operator? How to get started with this repo? Installation setup?

ayaankhan98 commented 4 years ago

I have previously written code for multiplying signed long numeric integer strings, would like to contribute to the multiply '*' operator? How to get started with this repo? Installation setup?

you must have gcc and cmake installed on your system after installing this you will be able to build the code on your system

justinbax commented 4 years ago

I finished the == operator overload in PR #16 in order to write ctor tests. Everything works perfectly fine!

yashsoni501 commented 4 years ago

I would like to work on * operator. Will Karatsuba algorithm for multiplication be fine for this library?

ayaankhan98 commented 4 years ago

I would like to work on * operator. Will Karatsuba algorithm for multiplication be fine for this library?

@yashsoni501 yes, go ahead!

ufrshubham commented 4 years ago

Should implicit casting operators be also on this list. This will allow following use case. int a = 12; largeInt b = a;

Plus this will probably reduce the number of overloaded of other operators too.

ayaankhan98 commented 4 years ago

Should implicit casting operators be also on this list. This will allow following use case. int a = 12; largeInt b = a;

Plus this will probably reduce the number of overloaded of other operators too.

yes, please create issue for this.

ufrshubham commented 4 years ago

Should implicit casting operators be also on this list. This will allow following use case. int a = 12; largeInt b = a; Plus this will probably reduce the number of overloaded of other operators too.

yes, please create issue for this.

My bad. This operator is already implemented. Good that I didn't create a new issue for this.