Giter Site home page Giter Site logo

Add math functions about bigint HOT 32 OPEN

faheel avatar faheel commented on June 15, 2024
Add math functions

from bigint.

Comments (32)

faheel avatar faheel commented on June 15, 2024 1

Use Newton's method for sqrt().

from bigint.

anandsit043 avatar anandsit043 commented on June 15, 2024 1

Hi @arvindvs ,
I am working on GCD

from bigint.

abelmarm avatar abelmarm commented on June 15, 2024

Have you started any of those?

from bigint.

faheel avatar faheel commented on June 15, 2024

No, I haven't

from bigint.

abelmarm avatar abelmarm commented on June 15, 2024

Mind if I start with pow?

from bigint.

faheel avatar faheel commented on June 15, 2024

Whichever way you like. For pow use the binary exponentiation method.

from bigint.

TheWindRider avatar TheWindRider commented on June 15, 2024

Hello! Came across this project from Up For Grabs

I have some doubt on the new pow function. It's doing the a^n = (-a)^(1/n) if n < 0 transformation, but I think the formula should be a^n = 1/(a^(-n)) if n < 0.

And the test didn't include any n < 0 cases yet...

from bigint.

faheel avatar faheel commented on June 15, 2024

Yeah, I'm fixing the pow function and the tests. There are a few more issues with it such as handling 00, 0-1, 0-2 etc.

from bigint.

arvindvs avatar arvindvs commented on June 15, 2024

Mind if I try to get started on sqrt?

from bigint.

faheel avatar faheel commented on June 15, 2024

@arvindvs Sure, go ahead!

from bigint.

arvindvs avatar arvindvs commented on June 15, 2024

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?

from bigint.

faheel avatar faheel commented on June 15, 2024

Yes, you can push your changes and create a PR. Then you can comment regarding the issue you're facing in your PR.

from bigint.

anandsit043 avatar anandsit043 commented on June 15, 2024

Hi,
I would like to contribute this project. Can I implement gcd part?

from bigint.

faheel avatar faheel commented on June 15, 2024

@anandsit043 Sure!

from bigint.

arvindvs avatar arvindvs commented on June 15, 2024

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)

from bigint.

KingAkeem avatar KingAkeem commented on June 15, 2024

I would like to take up the is_probable_prime function if no is currently working on it.

from bigint.

faheel avatar faheel commented on June 15, 2024

@KingAkeem Go for it, as it doesn't seem like anyone else is working on it.

from bigint.

KingAkeem avatar KingAkeem commented on June 15, 2024

Awesome, I'm working on implementing Rabin-Miller primality testing now.

from bigint.

KingAkeem avatar KingAkeem commented on June 15, 2024

Should is_probable_prime be declared as a public member function but defined inside of math.hpp?

from bigint.

faheel avatar faheel commented on June 15, 2024

@KingAkeem Yes.

from bigint.

anandsit043 avatar anandsit043 commented on June 15, 2024

Hi @arvindvs,
Should I implement the lcm part or you are done with it?

from bigint.

arvindvs avatar arvindvs commented on June 15, 2024

@anandsit043 Sorry for the late response. Go ahead, I have not yet completed LCM.

from bigint.

asas2016SEC avatar asas2016SEC commented on June 15, 2024

how can i contribute to this project. I new to open source. Please guide.

from bigint.

faheel avatar faheel commented on June 15, 2024

@AanjaneyaSinghDhoni All of the functions mentioned in this issue have been implemented (PR for is_probable_prime is under review).

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.

from bigint.

cedrikaagaard avatar cedrikaagaard commented on June 15, 2024

Hello, is_probable_prime is not yet implemented right? Would it be okay if I gave it a shot?

from bigint.

ankur54 avatar ankur54 commented on June 15, 2024

Hello! Is this issue still open? I would like to contribute to it.

from bigint.

DefUs3r avatar DefUs3r commented on June 15, 2024

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.

from bigint.

liamob avatar liamob commented on June 15, 2024

Hello! I'll give the "is_probable_prime" function a try! I'll send a message when it's finished.

from bigint.

jslcontributor avatar jslcontributor commented on June 15, 2024

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
Any tips?

from bigint.

youcefl avatar youcefl commented on June 15, 2024

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
Any tips?

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.
Have a look at https://en.wikipedia.org/wiki/Modular_exponentiation and/or https://www.geeksforgeeks.org/modular-exponentiation-power-in-modular-arithmetic/.

from bigint.

Muthulakshimi avatar Muthulakshimi commented on June 15, 2024

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..

from bigint.

Wodlfvllf avatar Wodlfvllf commented on June 15, 2024

Hello sir I would like to add some math function.Please assignit to me

from bigint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.