Giter Site home page Giter Site logo

Comments (8)

KingAkeem avatar KingAkeem commented on June 18, 2024

Would I be able to work on this?

from bigint.

faheel avatar faheel commented on June 18, 2024

@KingAkeem Sure, go ahead!

from bigint.

KingAkeem avatar KingAkeem commented on June 18, 2024

I'm not sure how you want the multiply to be optimized, I attempted to just append zeros based on the size of the number but that's much slower than normal multiplication. I don't think we can make it more optimized than the compiler without writing ASM.

from bigint.

faheel avatar faheel commented on June 18, 2024

Say you have num1 and num2 as the two BigInt operands. Then, if any one of them is found to be a power of 10 (say it's num1), you can append the zeroes at once instead of using a loop, like so:

num2.value.append(num1.value.begin() + 1, num1.value.end());

This will certainly be much faster than simply carrying on with the multiplication.

from bigint.

KingAkeem avatar KingAkeem commented on June 18, 2024

I should've thought a little more about how I could utilize the BigInt objects first. I'm going to try both of those out right now.

from bigint.

Aakankshareddy avatar Aakankshareddy commented on June 18, 2024

Hi,would like to contribute. Should I implement it in math.hpp or create a separate file?

from bigint.

faheel avatar faheel commented on June 18, 2024

@Aakankshareddy The operators have already been defined in operators/binary_arithmetic.hpp. You have to add checks within the definitions of the operators that are mentioned at the top, using a function named is_power_of_10(), which you can define in functions/utilities.hpp.

from bigint.

MagmaCode avatar MagmaCode commented on June 18, 2024

I gave it a try. Hope it is good enough.
The tests pass and run times also seem to have decreased, which is good.

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.