Skip to content

A C++ class that handles really big real numbers that exceeds the limits of c++

Notifications You must be signed in to change notification settings

minahermina/BigReal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

BigReal Class

Table of Contents

Introduction

The BigReal class is designed to represent real numbers with both integer and fractional components. It can handle large numbers that exceed the limitations of standard C++ data types by utilizing the BigDecimalInt class for managing integer digits.

Class Overview

The class has the following private members:

  • BigDecimalInt integerDigits: Represents the integer part of the real number.
  • BigDecimalInt fractionDigits: Represents the fractional part of the real number.
  • char Sign: Represents the sign of the real number ('+', '-' ).

It also provides various member functions for performing arithmetic operations, handling carries and borrows, and managing the format of fractions.

Constructor

The BigReal class provides several constructors:

  • BigReal(double = 0.0): Default constructor.
  • BigReal(string): Constructor to initialize from a string.
  • BigReal(BigDecimalInt): Constructor to initialize from a BigDecimalInt object.
  • BigReal(BigDecimalInt, BigDecimalInt, char): Constructor to initialize all components explicitly.

Assignment Operators

The class supports assignment from various types, including string, BigDecimalInt, int, and long long.

Arithmetic Operators

The class supports addition and subtraction operations for BigReal objects.

Relational Operators

Relational operators such as <, >, and == are implemented to compare BigReal objects.

IO Operators

Input and output stream operators (<< and >>) are overloaded to facilitate easy input and output of BigReal objects.

Getter Methods

The class provides methods to retrieve the size and sign of the BigReal object.

Example Usage

Here is an example of how to use the BigReal class:

#include "BigReal.h"
#include <iostream>
// Your code goes here

Authors

About

A C++ class that handles really big real numbers that exceeds the limits of c++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published