libcproject
C static library easier to use than libc (C standard library).
mathematics.h
Go to the documentation of this file.
1 #ifndef __LIBCPROJECT_MATHEMATICS__
2 #define __LIBCPROJECT_MATHEMATICS__
3 
4 #define MATHEMATICS_DOUBLE_PRECISION 0.0000000001
5 
6 #include <errno.h>
7 #include <stdbool.h>
8 #include <stdlib.h>
9 
10 #include "types.h"
11 
20 bool mathematics_equals(const float64_t number1, const float64_t number2);
21 
29 uint64_t mathematics_absolute_value(const int64_t number);
30 
39 uint64_t mathematics_pow(uint64_t base, uint64_t exponent);
40 
49 float64_t mathematics_root(float64_t number, uint64_t nth_root);
50 
59 
67 uint64_t mathematics_factorial(uint64_t number);
68 
82 int64_t mathematics_opposite(int64_t number);
83 
92 int64_t mathematics_max(int64_t number1, int64_t number2);
93 
102 int64_t mathematics_max_values(int64_t *values, size_t values_length);
103 
112 int64_t mathematics_min(int64_t number1, int64_t number2);
113 
122 int64_t mathematics_min_values(int64_t *values, size_t values_length);
123 
124 #endif
int64_t mathematics_max(int64_t number1, int64_t number2)
Returns the largest number between 2 numbers.
bool mathematics_equals(const float64_t number1, const float64_t number2)
Verify that 2 numbers are equal.
uint64_t mathematics_factorial(uint64_t number)
Calculates the factorial of a number.
int64_t mathematics_opposite(int64_t number)
Calulcates the opposite number (additive inverse).
int64_t mathematics_min(int64_t number1, int64_t number2)
Returns the smallest number between 2 numbers.
int64_t mathematics_min_values(int64_t *values, size_t values_length)
Returns the smallest number between multiple numbers. If the array is empty, returns 0.
int64_t mathematics_max_values(int64_t *values, size_t values_length)
Returns the largest number between multiple numbers. If the array is empty, returns 0.
uint64_t mathematics_absolute_value(const int64_t number)
Get the absolute value of a number.
float64_t mathematics_square_root(float64_t number)
Calculates the square root of a number using Heron's method.
float64_t mathematics_root(float64_t number, uint64_t nth_root)
Calculates the nth root of a number.
uint64_t mathematics_pow(uint64_t base, uint64_t exponent)
Calculates the power of a number.
double float64_t
Definition: types.h:11