NewLang Project
Yet another programm language
|
#include <rational.h>
Classes | |
struct | CtxHelper |
Public Member Functions | |
BigNum () | |
BigNum (const int64_t var) | |
BigNum (const std::string_view str) | |
BigNum (const BigNum ©) | |
BigNum & | set_ (const BigNum ©) |
BigNum & | set_ (const int64_t var) |
BigNum & | operator= (const BigNum &var) |
BigNum & | operator= (const int64_t var) |
virtual | ~BigNum () |
int64_t | GetAsInteger () const |
double | GetAsNumber () const |
bool | SetFromString (const std::string_view str) |
std::string | GetAsString () const |
BigNum & | add (const BigNum &val) |
BigNum & | sub (const BigNum &val) |
BigNum & | mul (const BigNum &val) |
BigNum & | div (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 |
Definition at line 11 of file rational.h.
BigNum::BigNum | ( | ) |
Definition at line 23 of file rational.cpp.
BigNum::BigNum | ( | const int64_t | var | ) |
Definition at line 27 of file rational.cpp.
References set_().
BigNum::BigNum | ( | const std::string_view | str | ) |
Definition at line 31 of file rational.cpp.
References SetFromString().
BigNum::BigNum | ( | const BigNum & | copy | ) |
Definition at line 35 of file rational.cpp.
|
virtual |
Definition at line 65 of file rational.cpp.
References value.
Definition at line 39 of file rational.cpp.
Referenced by BigNum(), newlang::Rational::op_compare(), operator=(), operator=(), and newlang::Rational::set_().
BigNum & BigNum::set_ | ( | const int64_t | var | ) |
Definition at line 44 of file rational.cpp.
References value.
Definition at line 55 of file rational.cpp.
References set_().
BigNum & BigNum::operator= | ( | const int64_t | var | ) |
Definition at line 60 of file rational.cpp.
References set_().
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().
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().
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_().
std::string BigNum::GetAsString | ( | ) | const |
Definition at line 131 of file rational.cpp.
Referenced by newlang::Rational::GetAsString().
Definition at line 139 of file rational.cpp.
References LOG_RUNTIME, and value.
Referenced by newlang::Rational::operator+=().
Definition at line 147 of file rational.cpp.
References LOG_RUNTIME, and value.
Referenced by newlang::Rational::operator-=().
Definition at line 155 of file rational.cpp.
References newlang::BigNum::CtxHelper::ctx, LOG_RUNTIME, and value.
Referenced by newlang::Rational::operator*=(), newlang::Rational::operator+=(), newlang::Rational::operator-=(), and newlang::Rational::operator/=().
Definition at line 164 of file rational.cpp.
References newlang::BigNum::CtxHelper::ctx, LOG_RUNTIME, and value.
Referenced by newlang::Rational::GetAsInteger(), GetAsNumber(), and newlang::Rational::reduce().
void BigNum::SetOne | ( | ) |
void BigNum::SetZero | ( | ) |
Definition at line 178 of file rational.cpp.
References value.
bool BigNum::isOverflow | ( | ) | const |
Definition at line 183 of file rational.cpp.
References value.
Referenced by GetAsInteger(), and GetAsNumber().
bool BigNum::isZero | ( | ) | const |
Definition at line 188 of file rational.cpp.
References value.
Referenced by newlang::Rational::GetAsBoolean(), newlang::Rational::GetAsInteger(), newlang::Rational::GetAsNumber(), and newlang::Rational::reduce().
bool BigNum::isOne | ( | ) | const |
Definition at line 193 of file rational.cpp.
References value.
Referenced by newlang::Rational::GetAsInteger(), and newlang::Rational::GetAsNumber().
bool BigNum::isNegative | ( | ) | const |
Definition at line 198 of file rational.cpp.
References value.
void* newlang::BigNum::value |
Definition at line 12 of file rational.h.
Referenced by add(), BigNum(), BigNum(), div(), GetAsInteger(), GetAsNumber(), GetAsString(), isNegative(), isOne(), isOverflow(), isZero(), mul(), newlang::Rational::op_compare(), newlang::Rational::op_equal(), newlang::Rational::reduce(), set_(), set_(), newlang::Rational::set_(), SetFromString(), SetOne(), SetZero(), sub(), and ~BigNum().