NewLang Project
Yet another programm language
Loading...
Searching...
No Matches
newlang::BigNum Struct Reference

#include <rational.h>

Classes

struct  CtxHelper
 

Public Member Functions

 BigNum ()
 
 BigNum (const int64_t var)
 
 BigNum (const std::string_view str)
 
 BigNum (const BigNum &copy)
 
BigNumset_ (const BigNum &copy)
 
BigNumset_ (const int64_t var)
 
BigNumoperator= (const BigNum &var)
 
BigNumoperator= (const int64_t var)
 
virtual ~BigNum ()
 
int64_t GetAsInteger () const
 
double GetAsNumber () const
 
bool SetFromString (const std::string_view str)
 
std::string GetAsString () const
 
BigNumadd (const BigNum &val)
 
BigNumsub (const BigNum &val)
 
BigNummul (const BigNum &val)
 
BigNumdiv (const BigNum &val, BigNum &rem)
 
void SetOne ()
 
void SetZero ()
 
bool isOverflow () const
 
bool isZero () const
 
bool isOne () const
 
bool isNegative () const
 

Public Attributes

void * value
 

Detailed Description

Definition at line 11 of file rational.h.

Constructor & Destructor Documentation

◆ BigNum() [1/4]

BigNum::BigNum ( )

Definition at line 23 of file rational.cpp.

References ASSERT, and value.

◆ BigNum() [2/4]

BigNum::BigNum ( const int64_t var)

Definition at line 27 of file rational.cpp.

References set_().

◆ BigNum() [3/4]

BigNum::BigNum ( const std::string_view str)

Definition at line 31 of file rational.cpp.

References SetFromString().

◆ BigNum() [4/4]

BigNum::BigNum ( const BigNum & copy)

Definition at line 35 of file rational.cpp.

References value, and VERIFY.

◆ ~BigNum()

BigNum::~BigNum ( )
virtual

Definition at line 65 of file rational.cpp.

References value.

Member Function Documentation

◆ set_() [1/2]

BigNum & BigNum::set_ ( const BigNum & copy)

Definition at line 39 of file rational.cpp.

References value, and VERIFY.

Referenced by BigNum(), newlang::Rational::op_compare(), operator=(), operator=(), and newlang::Rational::set_().

◆ set_() [2/2]

BigNum & BigNum::set_ ( const int64_t var)

Definition at line 44 of file rational.cpp.

References value.

◆ operator=() [1/2]

BigNum & BigNum::operator= ( const BigNum & var)

Definition at line 55 of file rational.cpp.

References set_().

◆ operator=() [2/2]

BigNum & BigNum::operator= ( const int64_t var)

Definition at line 60 of file rational.cpp.

References set_().

◆ GetAsInteger()

int64_t BigNum::GetAsInteger ( ) const

Definition at line 72 of file rational.cpp.

References isOverflow(), LOG_RUNTIME, result, and value.

Referenced by newlang::Rational::GetAsInteger(), and GetAsNumber().

◆ GetAsNumber()

double BigNum::GetAsNumber ( ) const

Definition at line 88 of file rational.cpp.

References ASSERT, div(), GetAsInteger(), isOverflow(), result, SetOne(), and value.

Referenced by newlang::Rational::GetAsNumber().

◆ SetFromString()

bool BigNum::SetFromString ( const std::string_view str)

Definition at line 121 of file rational.cpp.

References ASSERT, LOG_RUNTIME, and value.

Referenced by BigNum(), and newlang::Rational::set_().

◆ GetAsString()

std::string BigNum::GetAsString ( ) const

Definition at line 131 of file rational.cpp.

References result, and value.

Referenced by newlang::Rational::GetAsString().

◆ add()

BigNum & BigNum::add ( const BigNum & val)

Definition at line 139 of file rational.cpp.

References LOG_RUNTIME, and value.

Referenced by newlang::Rational::operator+=().

◆ sub()

BigNum & BigNum::sub ( const BigNum & val)

Definition at line 147 of file rational.cpp.

References LOG_RUNTIME, and value.

Referenced by newlang::Rational::operator-=().

◆ mul()

◆ div()

BigNum & BigNum::div ( const BigNum & val,
BigNum & rem )

◆ SetOne()

void BigNum::SetOne ( )

Definition at line 173 of file rational.cpp.

References value.

Referenced by GetAsNumber().

◆ SetZero()

void BigNum::SetZero ( )

Definition at line 178 of file rational.cpp.

References value.

◆ isOverflow()

bool BigNum::isOverflow ( ) const

Definition at line 183 of file rational.cpp.

References value.

Referenced by GetAsInteger(), and GetAsNumber().

◆ isZero()

bool BigNum::isZero ( ) const

◆ isOne()

bool BigNum::isOne ( ) const

Definition at line 193 of file rational.cpp.

References value.

Referenced by newlang::Rational::GetAsInteger(), and newlang::Rational::GetAsNumber().

◆ isNegative()

bool BigNum::isNegative ( ) const

Definition at line 198 of file rational.cpp.

References value.

Member Data Documentation

◆ value


The documentation for this struct was generated from the following files: