-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add math functions #5
Comments
Have you started any of those? |
No, I haven't |
Mind if I start with pow? |
Whichever way you like. For |
Hello! Came across this project from Up For Grabs I have some doubt on the new And the test didn't include any |
Yeah, I'm fixing the |
Mind if I try to get started on sqrt? |
@arvindvs Sure, go ahead! |
Use Newton's method for |
I'm currently having trouble compiling the code (sorry I'm completely new to open source and contributions ). I have edited the math.test.cpp file and math.hpp file and they are ready to commit to the branch I have created. Is it alright if I go ahead and push this commit without compiling and correcting potential errors, and you can take a look at it? |
Yes, you can push your changes and create a PR. Then you can comment regarding the issue you're facing in your PR. |
Hi, |
@anandsit043 Sure! |
Can I get started on LCM? (I will have to implement GCD in order to make this work. If someone else is working on GCD, I can wait for them to finish. Otherwise I can proceed with both) |
Hi @arvindvs , |
I would like to take up the is_probable_prime function if no is currently working on it. |
@KingAkeem Go for it, as it doesn't seem like anyone else is working on it. |
Awesome, I'm working on implementing Rabin-Miller primality testing now. |
Should is_probable_prime be declared as a public member function but defined inside of math.hpp? |
@KingAkeem Yes. |
Hi @arvindvs, |
@anandsit043 Sorry for the late response. Go ahead, I have not yet completed LCM. |
how can i contribute to this project. I new to open source. Please guide. |
@AanjaneyaSinghDhoni All of the functions mentioned in this issue have been implemented (PR for If you'd like to contribute, you can try implementing the functions mentioned in issues #18 and #19. If you need some more info regarding implementation details, comment on the respective issues. |
Hello, |
Hello! Is this issue still open? I would like to contribute to it. |
Hello @faheel sir, I am new to contributions and cmake, though I have a very good experience in coding with c++. I would like to take up the task of building a function out of the list mentioned above or if you can suggest any new function. Or if there's any other issue that might suit me, please suggest. |
Hello! I'll give the "is_probable_prime" function a try! I'll send a message when it's finished. |
Hello @faheel I have implemented and tested the is_probable_prime function, however it is difficult to test using a very large number due to the incredibly significant runtime caused when you take the (randomNumber) to the power of another amount. On the wikipedia page (https://en.wikipedia.org/wiki/Miller–Rabin_primality_test) it would be where the pseudocode says x ← a^d mod n |
You have to implement and use a modular exponentiation i.e. when computing X = A^B mod N, you do not compute A^B and then take the remainder modulo N, you loop on the binary representation of B squaring and/or multiplying by A mod N depending on whether the current bit is set. |
Hi, checked this up at -up for grabs. Can someone help me with understanding what I should do? Does this issue ask for coding any program with math functions.. |
Hello sir I would like to add some math function.Please assignit to me |
Note: type
T
can be aBigInt
,std::string
orlong long
.pow
Returns the value of baseexponent.
sqrt
Returns the square root of
num
.gcd
Returns the GCD of
num1
andnum2
.lcm
Returns the LCM of
num1
andnum2
.is_probable_prime
Returns
true
with a certainty offor whether this BigInt is prime, based on either the Fermat or Miller-Rabin primality tests. Similar to Java's
BigInteger.isProbablePrime
.The text was updated successfully, but these errors were encountered: