Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] operator overloads #4

Open
8 of 17 tasks
ayaankhan98 opened this issue Oct 4, 2020 · 22 comments · Fixed by #48 or #59
Open
8 of 17 tasks

[feat] operator overloads #4

ayaankhan98 opened this issue Oct 4, 2020 · 22 comments · Fixed by #48 or #59
Labels
enhancement New feature or request hacktoberfest hacktoberfest 2020 testing

Comments

@ayaankhan98
Copy link
Owner

ayaankhan98 commented Oct 4, 2020

  • + overload

  • - overload

  • * overload

  • / overload

  • += overload

  • -= overload

  • *= overload

  • /= overload

  • % overload

  • %= overload

  • == overload

  • = overload

  • != overload

  • < overload

  • <= overload

  • > overload

  • >= overload

also include tests for corrosponding operators

@ayaankhan98 ayaankhan98 added enhancement New feature or request testing hacktoberfest hacktoberfest 2020 labels Oct 4, 2020
@Tripathi-Alok
Copy link

what we have to do with these operators?Please Explain

@ayaankhan98
Copy link
Owner Author

@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
Copy link

Alok-873 commented Oct 4, 2020

Okay can i try on this issue?

@Alok-873
Copy link

Alok-873 commented Oct 4, 2020

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

@ayaankhan98
Copy link
Owner Author

ayaankhan98 commented Oct 4, 2020

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
Copy link

Minimum how many operators we can take

@ayaankhan98
Copy link
Owner Author

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

@Tripathi-Alok
Copy link

I would like to work on + - operators

@ayaankhan98
Copy link
Owner Author

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

@Tripathi-Alok
Copy link

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

@ayaankhan98
Copy link
Owner Author

@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
Copy link
Contributor

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
Copy link

I am working on < operator

@MonarchChakri
Copy link

@ayaankhan98
Created a PR #17
Please review and merge.

@sanjay035
Copy link

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
Copy link
Owner Author

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
Copy link
Contributor

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

@yashsoni501
Copy link
Contributor

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

@ayaankhan98
Copy link
Owner Author

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

@yashsoni501 yes, go ahead!

@ufrshubham
Copy link
Contributor

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
Copy link
Owner Author

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.

@ayaankhan98 ayaankhan98 linked a pull request Oct 9, 2020 that will close this issue
7 tasks
@ufrshubham
Copy link
Contributor

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.

@ayaankhan98 ayaankhan98 linked a pull request Oct 22, 2020 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest hacktoberfest 2020 testing
Projects
None yet
8 participants