Skip to content

Latest commit

 

History

History
66 lines (52 loc) · 2.54 KB

README.md

File metadata and controls

66 lines (52 loc) · 2.54 KB

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