Steppable 0.0.1
A CAS project written from scratch in C++
|
Classes | |
struct | QuotientRemainder |
Represents the quotient and remainder of a division operation. More... | |
struct | Surd |
A struct to represent a surd. A surd is a number that cannot be simplified to remove a square root. It is expressed as ![]() | |
Functions | |
std::string | representNumber (const std::string &_number) |
Represents a number using alphabets and numberals. | |
std::string | baseConvert (const std::string &_number, const std::string &baseStr, int steps=2) |
Converts a string representation of a number from decimal to another one. | |
std::string | toNumber (const char _input) |
Converts a numeral character to a number string. | |
std::string | decimalConvert (const std::string &_inputString, const std::string &baseString, int steps=2) |
Converts a string representation of a number from any base to decimal. | |
types::Result< Number > | _abs (const std::string &_number) |
std::string | abs (const std::string &_number, int steps) |
Calculates the absolute value of a string representation of a number. | |
std::string | add (const std::string &a, const std::string &b, int steps=2, bool negative=false, bool properlyFormat=true) |
Adds two string representations of numbers, and performs with the column method. | |
std::string | atan2 (const std::string &y, const std::string &x, const size_t decimals=10) |
std::string | compare (const std::string &_a, const std::string &_b, int steps=2) |
Compares two string representations of numbers. | |
QuotientRemainder | getQuotientRemainder (const auto &_currentRemainder, const auto &divisor) |
long long | determineResultScale (const std::string &_number, const std::string &_divisor) |
Determines the scale of the quotient of division. | |
std::string | divide (const std::string &number, const std::string &divisor, int steps=2, int decimals=5) |
Divides a string representation of a number by another string representation of a number. | |
QuotientRemainder | divideWithQuotient (const std::string &number, const std::string &divisor) |
std::string | getGCD (const std::string &_a, const std::string &_b) |
Gets the greatest common divisor of two string representations of numbers. | |
std::string | factorial (const std::string &_number, int steps=2) |
Calculates the factorial of a number. | |
std::string | sinh (const std::string &x, int decimals) |
Hyperbolic sine function. | |
std::string | cosh (const std::string &x, int decimals) |
Hyperbolic cosine function. | |
std::string | tanh (const std::string &x, int decimals) |
Hyperbolic tangent function. | |
std::string | coth (const std::string &x, int decimals) |
Hyperbolic tangent function. | |
std::string | csch (const std::string &x, int decimals) |
Hyperbolic tangent function. | |
std::string | sech (const std::string &x, int decimals) |
Hyperbolic tangent function. | |
std::string | asinh (const std::string &x, int decimals) |
Inverse hyperbolic sine function. | |
std::string | acosh (const std::string &x, int decimals) |
Inverse hyperbolic cosine function. | |
std::string | atanh (const std::string &x, int decimals) |
Inverse hyperbolic tangent function. | |
std::string | acoth (const std::string &x, int decimals) |
Inverse hyperbolic cotangent function. | |
std::string | acsch (const std::string &x, int decimals) |
Inverse hyperbolic cosecant function. | |
std::string | asech (const std::string &x, int decimals) |
Inverse hyperbolic secant function. | |
std::string | _log (const std::string &x, const size_t _decimals) |
std::string | logb (const std::string &_number, const std::string &_base, size_t _decimals) |
Calculates the logarithm with a given base. | |
std::string | log10 (const std::string &_number, size_t _decimals) |
Calculates the common logarithm of a number. | |
std::string | log2 (const std::string &_number, size_t _decimals) |
Calculates the binary logarithm of a number. | |
std::string | ln (const std::string &_number, size_t _decimals) |
Calculates the natural logarithm of a number. | |
std::string | multiply (const std::string &a, const std::string &b, int steps=2, int decimals=MAX_DECIMALS) |
Multiplies two string representations of numbers. | |
std::string | power (const std::string &_number, const std::string &raiseTo, int steps=2, int decimals=8) |
Raises a string representation of a number to a power. | |
std::string | exp (const std::string &x, size_t decimals=10) |
Calculates e^x. Shorthand of power(x, E, 0);. | |
std::string | rootIntPart (const std::string &_number, const std::string &base) |
Gets the integer part of the root of a number. | |
Surd | rootSurd (const std::string &_number, const std::string &base) |
Converts a root operation into a surd. | |
std::string | _root (const std::string &_number, const std::string &base, const size_t _decimals, const int steps) |
std::string | root (const std::string &_number, const std::string &base, size_t decimals=8, int steps=0) |
Takes the n-th root of a numer. | |
std::string | subtract (const std::string &a, const std::string &b, int steps=2, bool noMinus=false) |
Subtracts one string representation of a number from another string representation of a number. | |
std::string | degToRad (const std::string &_deg) |
Converts degrees to radians. | |
std::string | gradToRad (const std::string &_grad) |
Converts gradians to radians. | |
std::string | radToDeg (const std::string &_rad, const int decimals) |
std::string | radToGrad (const std::string &_rad, const int decimals) |
std::string | gradToDeg (const std::string &_grad) |
std::string | _cos (const std::string &x, const int _decimals) |
std::string | cos (const std::string &x, int decimals, int mode=0) |
Calculates the cosine of a number. | |
std::string | sin (const std::string &x, int decimals, int mode=0) |
Calculates the sine of a number. | |
std::string | tan (const std::string &x, int decimals, int mode=0) |
Calculates the tangent of a number. | |
std::string | csc (const std::string &x, int decimals, int mode=0) |
Calculates the cosecant of a number. | |
std::string | sec (const std::string &x, int decimals, int mode=0) |
Calculates the secant of a number. | |
std::string | cot (const std::string &x, int decimals, int mode=0) |
Calculates the cotangent of a number. | |
std::string | atan (const std::string &x, int decimals, int mode=0) |
Calculates the arc tangent of a number. | |
std::string | asin (const std::string &x, int decimals, int mode=0) |
Calculates the arc sine of a number. | |
std::string | acos (const std::string &x, int decimals, int mode=0) |
Calculates the arc cosine of a number. | |
std::string | asec (const std::string &x, int decimals, int mode=0) |
Calculates the arc secant of a number. | |
std::string | acsc (const std::string &x, int decimals, int mode=0) |
Calculates the arc cosecant of a number. | |
std::string | acot (const std::string &x, int decimals, int mode=0) |
Calculates the arc cotangent of a number. | |
template<typename Pred> | |
void | loop (const std::string ×, Pred predicate) |
Executes a given predicate function a specified number of times. | |
types::Result< Number > steppable::__internals::calc::_abs | ( | const std::string & | _number | ) |
std::string steppable::__internals::calc::_cos | ( | const std::string & | x, |
const int | _decimals ) |
std::string steppable::__internals::calc::_log | ( | const std::string & | x, |
const size_t | _decimals ) |
std::string steppable::__internals::calc::_root | ( | const std::string & | _number, |
const std::string & | base, | ||
const size_t | _decimals, | ||
const int | steps ) |
std::string steppable::__internals::calc::abs | ( | const std::string & | _number, |
int | steps ) |
Calculates the absolute value of a string representation of a number.
[in] | _number | The string representation of the number. |
[in] | steps | The number of steps to perform the calculation. |
std::string steppable::__internals::calc::acos | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the arc cosine of a number.
x | The number to calculate the arc cosine of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the arc cosine in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::acosh | ( | const std::string & | x, |
int | decimals ) |
Inverse hyperbolic cosine function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::acot | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the arc cotangent of a number.
x | The number to calculate the arc cotangent of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the arc cotangent in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::acoth | ( | const std::string & | x, |
int | decimals ) |
Inverse hyperbolic cotangent function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::acsc | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the arc cosecant of a number.
x | The number to calculate the arc cosecant of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the arc cosecant in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::acsch | ( | const std::string & | x, |
int | decimals ) |
Inverse hyperbolic cosecant function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::add | ( | const std::string & | a, |
const std::string & | b, | ||
int | steps = 2, | ||
bool | negative = false, | ||
bool | properlyFormat = true ) |
Adds two string representations of numbers, and performs with the column method.
[in] | a | The first string representation of the number. |
[in] | b | The second string representation of the number. |
[in] | steps | The number of steps to perform the addition. 2 = column method, 1 = normal addition, 0 = result only. Default is 2. |
[in] | negative | Flag indicating whether the result should be negative. |
[in] | properlyFormat | Flag indicating whether to properly format the output. Default true. |
std::string steppable::__internals::calc::asec | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the arc secant of a number.
x | The number to calculate the arc secant of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the arc secant in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::asech | ( | const std::string & | x, |
int | decimals ) |
Inverse hyperbolic secant function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::asin | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the arc sine of a number.
x | The number to calculate the arc sine of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the arc sine in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::asinh | ( | const std::string & | x, |
int | decimals ) |
Inverse hyperbolic sine function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::atan | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the arc tangent of a number.
x | The number to calculate the arc tangent of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the arc tangent in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::atan2 | ( | const std::string & | y, |
const std::string & | x, | ||
const size_t | decimals = 10 ) |
std::string steppable::__internals::calc::atanh | ( | const std::string & | x, |
int | decimals ) |
Inverse hyperbolic tangent function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::baseConvert | ( | const std::string & | _number, |
const std::string & | baseStr, | ||
int | steps = 2 ) |
Converts a string representation of a number from decimal to another one.
[in] | _number | The string representation of the number. |
[in] | baseStr | The desired base. |
[in] | steps | The number of steps to perform the conversion. |
std::string steppable::__internals::calc::compare | ( | const std::string & | _a, |
const std::string & | _b, | ||
int | steps = 2 ) |
Compares two string representations of numbers.
[in] | _a | The first string representation of the number. |
[in] | _b | The second string representation of the number. |
[in] | steps | The number of steps to perform the comparison. |
std::string steppable::__internals::calc::cos | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the cosine of a number.
x | The number to calculate the cosine of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the cosine in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::cosh | ( | const std::string & | x, |
int | decimals ) |
Hyperbolic cosine function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::cot | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the cotangent of a number.
x | The number to calculate the cotangent of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the cotangent in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::coth | ( | const std::string & | x, |
int | decimals ) |
Hyperbolic tangent function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::csc | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the cosecant of a number.
x | The number to calculate the cosecant of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the cosecant in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::csch | ( | const std::string & | x, |
int | decimals ) |
Hyperbolic tangent function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::decimalConvert | ( | const std::string & | _inputString, |
const std::string & | baseString, | ||
int | steps = 2 ) |
Converts a string representation of a number from any base to decimal.
[in] | _inputString | The string representation of the number. |
[in] | baseString | The base of the input number. |
[in] | steps | The number of steps to perform the conversion. |
std::string steppable::__internals::calc::degToRad | ( | const std::string & | _deg | ) |
Converts degrees to radians.
_deg | The angle expressed in degrees. |
long long steppable::__internals::calc::determineResultScale | ( | const std::string & | _number, |
const std::string & | _divisor ) |
Determines the scale of the quotient of division.
[in] | _number | The number to be divided. |
[in] | _divisor | The divisor of the division. |
std::string steppable::__internals::calc::divide | ( | const std::string & | number, |
const std::string & | divisor, | ||
int | steps = 2, | ||
int | decimals = 5 ) |
Divides a string representation of a number by another string representation of a number.
[in] | number | The string representation of the dividend. |
[in] | divisor | The string representation of the divisor. |
[in] | steps | The number of steps to perform the division. |
[in] | decimals | The number of decimal places in the result. |
QuotientRemainder steppable::__internals::calc::divideWithQuotient | ( | const std::string & | number, |
const std::string & | divisor ) |
Calculates the quotient and remainder of dividing the current remainder by the divisor.
[in] | number | The number. |
[in] | divisor | The divisor. |
std::string steppable::__internals::calc::exp | ( | const std::string & | x, |
size_t | decimals = 10 ) |
Calculates e^x. Shorthand of power(x, E, 0);.
x | The string representation of the number. |
decimals | The number of decimals to output. |
std::string steppable::__internals::calc::factorial | ( | const std::string & | _number, |
int | steps = 2 ) |
Calculates the factorial of a number.
_number | The number to calculate the factorial of. |
steps | The number of steps to calculate the factorial. |
std::string steppable::__internals::calc::getGCD | ( | const std::string & | _a, |
const std::string & | _b ) |
QuotientRemainder steppable::__internals::calc::getQuotientRemainder | ( | const auto & | _currentRemainder, |
const auto & | divisor ) |
std::string steppable::__internals::calc::gradToDeg | ( | const std::string & | _grad | ) |
std::string steppable::__internals::calc::gradToRad | ( | const std::string & | _grad | ) |
Converts gradians to radians.
_grad | The angle expressed in gradians. |
std::string steppable::__internals::calc::ln | ( | const std::string & | _number, |
size_t | _decimals ) |
Calculates the natural logarithm of a number.
_number | The number to calculate the natural logarithm of. |
_decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::log10 | ( | const std::string & | _number, |
size_t | _decimals ) |
Calculates the common logarithm of a number.
_number | The number to calculate the common logarithm of. |
_decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::log2 | ( | const std::string & | _number, |
size_t | _decimals ) |
Calculates the binary logarithm of a number.
_number | The number to calculate the binary logarithm of. |
_decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::logb | ( | const std::string & | _number, |
const std::string & | _base, | ||
size_t | _decimals ) |
Calculates the logarithm with a given base.
_number | The number to calculate the logarithm of. |
_base | The base of the logarithm. |
_decimals | The number of decimal places to round off to. |
void steppable::__internals::calc::loop | ( | const std::string & | times, |
Pred | predicate ) |
Executes a given predicate function a specified number of times.
[in] | times | The number of times to execute the predicate function. |
[in] | predicate | The predicate function to execute. |
std::string steppable::__internals::calc::multiply | ( | const std::string & | a, |
const std::string & | b, | ||
int | steps = 2, | ||
int | decimals = MAX_DECIMALS ) |
Multiplies two string representations of numbers.
[in] | a | The first string representation of the number. |
[in] | b | The second string representation of the number. |
[in] | steps | The number of steps to perform the multiplication. |
std::string steppable::__internals::calc::power | ( | const std::string & | _number, |
const std::string & | raiseTo, | ||
int | steps = 2, | ||
int | decimals = 8 ) |
Raises a string representation of a number to a power.
[in] | _number | The string representation of the number. |
[in] | raiseTo | The string representation of the power to raise the number to. |
[in] | steps | The number of steps to perform the power operation. |
[in] | decimals | The number of decimals to output from the power operation. |
std::string steppable::__internals::calc::radToDeg | ( | const std::string & | _rad, |
const int | decimals ) |
std::string steppable::__internals::calc::radToGrad | ( | const std::string & | _rad, |
const int | decimals ) |
std::string steppable::__internals::calc::representNumber | ( | const std::string & | _number | ) |
Represents a number using alphabets and numberals.
[in] | _number | The number in decimal form. |
std::string steppable::__internals::calc::root | ( | const std::string & | _number, |
const std::string & | base, | ||
size_t | decimals = 8, | ||
int | steps = 0 ) |
Takes the n-th root of a numer.
_number | The number to take root of. |
base | The base of the root. |
decimals | The decimals of the operation. |
steps | The steps to show while taking the root. |
std::string steppable::__internals::calc::rootIntPart | ( | const std::string & | _number, |
const std::string & | base ) |
Gets the integer part of the root of a number.
_number | The number to get the root of. |
base | The base of the root. |
Surd steppable::__internals::calc::rootSurd | ( | const std::string & | _number, |
const std::string & | base ) |
Converts a root operation into a surd.
_number | The number to convert to a surd. |
base | The base of the root. |
std::string steppable::__internals::calc::sec | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the secant of a number.
x | The number to calculate the secant of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the secant in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::sech | ( | const std::string & | x, |
int | decimals ) |
Hyperbolic tangent function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::sin | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the sine of a number.
x | The number to calculate the sine of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the sine in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::sinh | ( | const std::string & | x, |
int | decimals ) |
Hyperbolic sine function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::subtract | ( | const std::string & | a, |
const std::string & | b, | ||
int | steps = 2, | ||
bool | noMinus = false ) |
Subtracts one string representation of a number from another string representation of a number.
[in] | a | The string representation of the minuend. |
[in] | b | The string representation of the subtrahend. |
[in] | steps | The number of steps to perform the subtraction. |
[in] | noMinus | Flag indicating whether to display a minus sign or not. |
std::string steppable::__internals::calc::tan | ( | const std::string & | x, |
int | decimals, | ||
int | mode = 0 ) |
Calculates the tangent of a number.
x | The number to calculate the tangent of. |
decimals | The number of decimal places to round off to. |
mode | The mode to calculate the tangent in. 0 = radians (default), 1 = degrees, 2 = gradians. |
std::string steppable::__internals::calc::tanh | ( | const std::string & | x, |
int | decimals ) |
Hyperbolic tangent function.
x | The number. |
decimals | The number of decimal places to round off to. |
std::string steppable::__internals::calc::toNumber | ( | const char | _input | ) |
Converts a numeral character to a number string.
[in] | _input | The character to convert. |