Line data Source code
1 1 : /** 2 : * @file calculator.h 3 : * 4 : * @brief Provides functions for math. utilities 5 : */ 6 : 7 : #ifndef CALCULATOR_H 8 : #define CALCULATOR_H 9 : 10 : #include "../../utility/header/commonTypes.h" 11 : 12 0 : namespace Coruh 13 : { 14 0 : namespace Calculator 15 : { 16 : /** 17 : @class Calculator 18 : @brief Provides Basic functions for various operations. 19 : */ 20 1 : class Calculator 21 : { 22 : public: 23 : /** 24 : * Adds two numbers. 25 : * @param a First operand. 26 : * @param b Second operand. 27 : * @return The sum of a and b. 28 : */ 29 1 : static double add(double a, double b); 30 : 31 : /** 32 : * Subtracts the second number from the first. 33 : * @param a Minuend. 34 : * @param b Subtrahend. 35 : * @return The result of a - b. 36 : */ 37 1 : static double subtract(double a, double b); 38 : 39 : /** 40 : * Multiplies two numbers. 41 : * @param a First operand. 42 : * @param b Second operand. 43 : * @return The product of a and b. 44 : */ 45 1 : static double multiply(double a, double b); 46 : 47 : /** 48 : * Divides the first number by the second. 49 : * Throws std::invalid_argument if the second number is zero. 50 : * @param a Dividend. 51 : * @param b Divisor. 52 : * @return The result of a / b. 53 : * @throws std::invalid_argument If b is zero. 54 : */ 55 1 : static double divide(double a, double b); 56 : 57 : 58 : }; 59 : } 60 : } 61 : 62 : #endif // CALCULATOR_H