Giter VIP home page Giter VIP logo

integer's Introduction

Very long integer class TInteger with various methods of multiplying methods, primality checking methods and other, in C++.

TInteger class overloaded operators:

  • Arithmetic: + - * / %
  • Comparison: == != > >= < <=
  • Type conversion: std::string int
  • Ostream/cout <<

Implemented methods:

  • Karatsuba multiplication method
  • Tom-Cook multiplication method
  • The Best Multiplication Method Ever 🤩 (WOW)
  • Newton's inverse method
  • Fermat primality check method
  • Rabin-Miller primality check method
  • Solovay-Strassen primality check method
  • Agrawal-Kayal-Saxena primality check method

Building

To build an executable for 64-bit Windows, I used MinGW w64 9.0 and CMake 3.23.2. More

Usage

The app takes arguments from a shell.

Usage: integer.exe [number of a method] [first integer] {second integer}

Numbers of the methods:

  • 0 - Output the given integers
  • 1 - Karatsuba multiplication method
  • 2 - Tom-Cook multiplication method
  • 5 - Newton's inverse method
  • 7 - Fermat primality check method
  • 8 - Rabin-Miller primality check method
  • 9 - Solovay-Strassen primality check method
  • 10 - Agrawal-Kayal-Saxena primality check method
  • 11 - Sum
  • 12 - Subtraction
  • 13 - Multiplication "in column"
  • 14 - Division
  • 15 - Remainder from division
  • 16 - The Best Multiplication Method Ever 🤩 (WOW)

Testing

This repository also contains a testing script in Python that runs all methods with random numbers, compares the results with python's fast and (I hope) correct results. To use this script, you need to install sympy (or remove the parts of the script that tests the primality check methods). After running the script, you can check a report in test.txt, where you can find out if the test was passed, its inputs and outputs and how much time it took to finish.

integer's People

Contributors

hahaslav avatar

Stargazers

 avatar

Watchers

 avatar

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.