GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - aadityanaik/LongNums: A custom made proof-of-concept class for handling numbers with large number of digits

BranchesTags
Open more actions menu

Latest commit

 

History

45 Commits
45 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
Future Updates.md
Future Updates.md
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 

Repository files navigation

LongNums

A custom made proof-of-concept class for arbitrary precision arithmetic.
Supports only integers.


Table of Operations

Key for examples-


Capitalised variables indicate `LongNumber` objects. Lower case variables indicate `int`s or `long`s.
Operation Function/
Operator
Example Notes
Input >> std::cin >> X;
Output << std::cout << X;
Assignment = X = y;
X = 123;
X = "-112";
Can equate with a long, LongNumber or a std::string. Will throw a InvalidInputException if it is unable to parse the string.
Comparison <
>
==
!=
X < Y;
X > 1123;
X == y;
X != 0;
Can compare a LongNumber with other LongNumbers, as well as longs and std::strings. Can use combined comparisons like <= or >=.
Addition +
+=
++
X + y;
X + Y;
X += Y;
X++;
++X;
Can add with longs as well as LongNumbers. Each notation has its standard meaning.
Subtraction -
-=
--
X - y;
X - Y;
X -= Y;
X--;
--X;
Can subtract longs as well as LongNumbers from the LongNumber. Each notation has its standard meaning.
Multiplication *
*=
X * y;
X * Y;
X *= Y;
Can multiply with longs as well as LongNumbers. Each notation has its standard meaning.
Division /
/=
X / y;
X / Y;
X /= Y;
Can divide with longs as well as LongNumbers. Each notation has its standard meaning. Dividing by zero will throw a DivisionByZero exception.
Modulo %
%=
X % y;
X % Y;
X %= Y;
Can find the modulus of LongNumber with longs as well as LongNumbers. Each notation has its standard meaning. Finding the modulus with 0 will throw a DivisionByZero exception.
Absolute absolute() X.absolute() Returns a LongNumber. Will not change the contents of X.
Cast to Long toLong() X.toLong() Returns a long. Does not account for overflow.

Exceptions

Name Function
DivideByZeroException Thrown when any attempt is made to divide by 0.
InvalidInputException Thrown when the entered string does not correspond to an integer.

About

A custom made proof-of-concept class for handling numbers with large number of digits

Topics

arbitrary-precision-integersbignumbignumbercplusplusdigitnumbersproofofconcept

Resources

Readme
Activity

Stars

4 stars

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.