1
1
mirror of https://github.com/theoludwig/libcproject.git synced 2024-11-13 23:43:13 +01:00

feat: add mathematics_opposite

This commit is contained in:
Théo LUDWIG 2024-09-13 14:44:26 +02:00
parent c49d5f5421
commit 85ce5228ef
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
2 changed files with 12 additions and 0 deletions

View File

@ -32,3 +32,7 @@ float mathematics_square_root(float number) {
unsigned long long mathematics_factorial(unsigned long long number) {
return number == 0 ? 1 : number * mathematics_factorial(number - 1);
}
int64_t mathematics_opposite(int64_t number) {
return number * -1;
}

View File

@ -66,4 +66,12 @@ float mathematics_square_root(float number);
*/
unsigned long long mathematics_factorial(unsigned long long number);
/**
* @brief Calulcates the opposite number (additive inverse).
*
* @param number
* @return int64_t
*/
int64_t mathematics_opposite(int64_t number);
#endif