|
IVS-calculator
|
Enumerations | |
| enum | MathError { OK , DIVISION_BY_ZERO , NEGATIVE_FACTORIAL , INVALID_ROOT , INVALID_ARGUMENT } |
Functions | |
| double | add (double a, double b) |
| Implementation of function add. | |
| double | subtract (double a, double b) |
| Implementation of function subtract. | |
| double | multiply (double a, double b) |
| Implementation of function multiply. | |
| double | divide (double a, double b, MathError &err) |
| Implementation of function divide. | |
| double | factorial (int a, MathError &err) |
| Implementation of function factorial. | |
| double | power (double base, int exp) |
| Implementation of function power. | |
| double | root (double base, int n, MathError &err) |
| Implementation of function root. | |
| double | modulo (double a, double b, MathError &err) |
| Implementation of function modulo. | |
| enum mathlib::MathError |
| Enumerator | |
|---|---|
| OK | |
| DIVISION_BY_ZERO | |
| NEGATIVE_FACTORIAL | |
| INVALID_ROOT | |
| INVALID_ARGUMENT | |
| double mathlib::add | ( | double | a, |
| double | b ) |
Implementation of function add.
Add two numbers.
| a | first number |
| b | second number |
Definition at line 9 of file mathlib.cpp.
| double mathlib::divide | ( | double | a, |
| double | b, | ||
| MathError & | err ) |
Implementation of function divide.
Divide two numbers.
| a | first number |
| b | second number |
| err | error code (division by zero) |
Definition at line 33 of file mathlib.cpp.
| double mathlib::factorial | ( | int | a, |
| MathError & | err ) |
Implementation of function factorial.
Compute factorial of a number.
| a | input number (must be >= 0) |
| err | error code (negative input) |
Definition at line 47 of file mathlib.cpp.
| double mathlib::modulo | ( | double | a, |
| double | b, | ||
| MathError & | err ) |
Implementation of function modulo.
Compute modulo of two numbers.
| a | first number |
| b | second number |
| err | error code (division by zero) |
Definition at line 111 of file mathlib.cpp.
| double mathlib::multiply | ( | double | a, |
| double | b ) |
Implementation of function multiply.
Multiply two numbers.
| a | first number |
| b | second number |
Definition at line 25 of file mathlib.cpp.
| double mathlib::power | ( | double | base, |
| int | exp ) |
Implementation of function power.
Raise a number to a natural exponent.
| base | input number |
| exp | exponent (must be >= 0) |
Definition at line 67 of file mathlib.cpp.
| double mathlib::root | ( | double | base, |
| int | n, | ||
| MathError & | err ) |
Implementation of function root.
Compute n-th root of a number.
| base | input number |
| n | degree of the root (must be > 0) |
| err | error code (invalid root) |
Definition at line 85 of file mathlib.cpp.
| double mathlib::subtract | ( | double | a, |
| double | b ) |
Implementation of function subtract.
Subtract two numbers.
| a | first number |
| b | second number |
Definition at line 17 of file mathlib.cpp.