libcproject
C static library easier to use than libc (C standard library).
mathematics.h File Reference
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include "types.h"
Include dependency graph for mathematics.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MATHEMATICS_DOUBLE_PRECISION   0.0000000001
 

Functions

bool mathematics_equals (const float64_t number1, const float64_t number2)
 Verify that 2 numbers are equal. More...
 
uint64_t mathematics_absolute_value (const int64_t number)
 Get the absolute value of a number. More...
 
uint64_t mathematics_pow (uint64_t base, uint64_t exponent)
 Calculates the power of a number. More...
 
float64_t mathematics_root (float64_t number, uint64_t nth_root)
 Calculates the nth root of a number. More...
 
float64_t mathematics_square_root (float64_t number)
 Calculates the square root of a number using Heron's method. More...
 
uint64_t mathematics_factorial (uint64_t number)
 Calculates the factorial of a number. More...
 
int64_t mathematics_opposite (int64_t number)
 Calulcates the opposite number (additive inverse). More...
 
int64_t mathematics_max (int64_t number1, int64_t number2)
 Returns the largest number between 2 numbers. More...
 
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. More...
 
int64_t mathematics_min (int64_t number1, int64_t number2)
 Returns the smallest number between 2 numbers. More...
 
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. More...
 

Macro Definition Documentation

◆ MATHEMATICS_DOUBLE_PRECISION

#define MATHEMATICS_DOUBLE_PRECISION   0.0000000001

Definition at line 4 of file mathematics.h.

Function Documentation

◆ mathematics_equals()

bool mathematics_equals ( const float64_t  number1,
const float64_t  number2 
)

Verify that 2 numbers are equal.

Parameters
number1
number2
Returns
bool
Since
v1.0.0

◆ mathematics_absolute_value()

uint64_t mathematics_absolute_value ( const int64_t  number)

Get the absolute value of a number.

Parameters
number
Returns
uint64_t
Since
v1.0.0

◆ mathematics_pow()

uint64_t mathematics_pow ( uint64_t  base,
uint64_t  exponent 
)

Calculates the power of a number.

Parameters
base
exponent
Returns
uint64_t
Since
v1.0.0

◆ mathematics_root()

float64_t mathematics_root ( float64_t  number,
uint64_t  nth_root 
)

Calculates the nth root of a number.

Parameters
number
nth_root
Returns
float64_t
Since
v1.0.0

◆ mathematics_square_root()

float64_t mathematics_square_root ( float64_t  number)

Calculates the square root of a number using Heron's method.

Parameters
number
Returns
float64_t
Since
v1.0.0

◆ mathematics_factorial()

uint64_t mathematics_factorial ( uint64_t  number)

Calculates the factorial of a number.

Parameters
number
Returns
uint64_t
Since
v1.0.0

◆ mathematics_opposite()

int64_t mathematics_opposite ( int64_t  number)

Calulcates the opposite number (additive inverse).

Parameters
number
Returns
int64_t
int64_t mathematics_opposite(int64_t number)
Calulcates the opposite number (additive inverse).
Since
v4.3.0

◆ mathematics_max()

int64_t mathematics_max ( int64_t  number1,
int64_t  number2 
)

Returns the largest number between 2 numbers.

Parameters
number1
number2
Returns
int64_t
Since
v4.3.0

◆ mathematics_max_values()

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.

Parameters
values
values_length
Returns
int64_t
Since
v4.3.0

◆ mathematics_min()

int64_t mathematics_min ( int64_t  number1,
int64_t  number2 
)

Returns the smallest number between 2 numbers.

Parameters
number1
number2
Returns
int64_t
Since
v4.3.0

◆ mathematics_min_values()

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.

Parameters
values
values_length
Returns
int64_t
Since
v4.3.0