9double add(
double a,
double b) {
57 for(
int i = 1; i <= a; i++) {
67double power(
double base,
int exp) {
75 for(
int i = 0; i < exp; i++) {
76 result = result * base;
95 if(base < 0 && n % 2 == 0) {
99 if(base < 0 && n % 2 != 0) {
101 return -std::pow(-base, 1.0 / n);
105 return std::pow(base, 1.0 / n);
120 return std::fmod(a, b);
Mathematical library for calculator project.
double root(double base, int n, MathError &err)
Implementation of function root.
double add(double a, double b)
Implementation of function add.
double multiply(double a, double b)
Implementation of function multiply.
double modulo(double a, double b, MathError &err)
Implementation of function modulo.
double divide(double a, double b, MathError &err)
Implementation of function divide.
double subtract(double a, double b)
Implementation of function subtract.
double factorial(int a, MathError &err)
Implementation of function factorial.
double power(double base, int exp)
Implementation of function power.