Coder Social home page Coder Social logo

intal-library's Introduction

INTAL

An INTAL can be defined as a non-negative integer of arbitrary length, where each decimal digit is represented as a character. The entire number is represented as an array of characters (string), with null termination. The most significant digit is at the head of the string. For eg. the number 1543 would be represented as a string S with '1' at S[0], '5' at S[1], '4' at S[2] and null char at S[3].

This is an implementation of a C library for the integers of arbitrary length (intal).

Difference from the Integer datatype in C

In C programming, int stands for integer, i.e., a non-decimal numeric value. It is stored as 2 or 4 bytes. The corresponding ranges for the values that could be stored are -32,768 to 32,767 for 2 bytes and -2,147,483,648 to 2,147,483,648 for 4 bytes. The fundamental difference lies in the definition of intals, they are non-negative integers, unlike the general integers which include negative numbers as well. Also, in this implementation, the range of intals has been resctricted by fixing the maximum number of digits in an INTAL as 1000. This allows us to represent numbers in the range (0,10^1000).This increased range allows us to work with much larger numbers that otherwise would be too large to store in a variable of the Integer datatype.

Applications

INTAL opertions can be used for faster computations of large numbers, which is not currently available directly in C. Operations on large numbers could be useful in fields like Biotechnology for Gene Sequence Representation with operations like intersection, union etc. and in the field of Number Theory.

Functions

  • Mathematical Operations
    1. Intal Addition
    2. Intal Subtraction
    3. Intal Comparison
    4. Intal Multiplication
    5. Modulo Operation
    6. Power Function
    7. Greatest Common Divisor
    8. nth Fibonacci
    9. Binomial Coefficient
    10. Factorial
  • Array of INTALs
    1. Maximum/Minimum INTAL
    2. Binary Search
    3. Sorting
    4. Dynamic Programming solution for the Coin-Row Problem:
      There is a row of n coins whose values are some positive integers C[0..n-1]. The goal is to pick up the maximum amount of money subject to the constraint that no two coins adjacent in the initial row can be picked up

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.