Coder Social home page Coder Social logo

ayaankhan98 / bigint Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 26.0 172 KB

Efficient OpenSource Big Integer(Library) Support for C++

License: Boost Software License 1.0

CMake 7.00% C++ 92.92% Shell 0.08%
cpp biginteger biginteger-cpp hacktoberfest hacktoberfest2020 cmake large-numbers opensource-library c-plus-plus open-source

bigint's Introduction

bigint's People

Contributors

ayaankhan98 avatar hashirgj8842 avatar justinbax avatar ufrshubham avatar vladpirlog avatar yashsoni501 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bigint's Issues

Issues with constructor with string in largeInt class

Describe the bug
When a largeInt object is initialized with a string of negative integer, then it prints double - sign when printed with cout.

To Reproduce
Steps to reproduce the behavior:
largeInt d("-234");
cout<<d<<endl;

Expected behavior
Output should be -234 but the output is --234

[feat] min() implementaion

min(a, b) returns the minimum of a and b

there could be different possible overloads
see #21 and implement the corrosponding min() overloads

[feat] max() implementation

implement the following function for largeInt class

  • max(a, b) returns the maximum of a and b
    max() can have overloads example
max(largeInt, largeInt);
max(largeInt, int);
max(largeInt, int64_t);

there are more possibile overloads
but for now aim is to implement these trivial overloads

[feat] operator overloads

  • + overload

  • - overload

  • * overload

  • / overload

  • += overload

  • -= overload

  • *= overload

  • /= overload

  • % overload

  • %= overload

  • == overload

  • = overload

  • != overload

  • < overload

  • <= overload

  • > overload

  • >= overload

also include tests for corrosponding operators

[feat] implement _builtin_parity(x) for largeInt

Description

  • This function is used to check the parity of a large int. This function returns true(1) if the number has odd parity else it returns false(0) for even parity.
  • include tests for new implementation

Unnecessary copies

Many of the operator overloads are taking in arguments by value. This will cause unnecessary copies of the objects. Better to convert them to const ref wherever possible.

Command file(COPY) not working as expected.

Describe the bug
Command file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/input.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/input.txt) in tests/operators/CMakeLists.txt actually copies input.txt under build/tests/operators/input.txt/input.txt

This means when tests try to open input.txt, they are opening a directory instead of actual *.txt file. Surprisingly std::ifstream::is_open() return true in such cases, causing the tests to be reported as pass with ever being run.

The command should be file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/input.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)

To Reproduce
Steps to reproduce the behavior:

  1. Configure the project with cmake.
  2. See the directory structure under build/tests/

Expected behavior
The additional input.txt directory should not be created.

Screenshots
image

Desktop:

  • OS: Windows 10 and Ubuntu 20.04

Some tests fails to open .txt files.

Describe the bug
Directory structure generated by MSVC compiler is a little different. This causes all the tests using txt files to fail, because they don't find the required input *.txt files. It seems cmake files will have to be modified to copy all the txt files to correct location depending on current platform.

To Reproduce
Steps to reproduce the behavior:

  1. Clone this repo on a Windows machine.
  2. Build it with cmake and MSVC compiler.
  3. Run tests.
  4. Some tests fail to open *.txt file.

Expected behavior
Tests should pass.

Desktop:

  • OS: Windows 10

Additional context
if(WIN32) can be used.

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.