Turnstone Operating System
Loading...
Searching...
No Matches
math.h File Reference

Math header. More...

#include <utils.h>

Macros

#define ___MATH_H   0
 
#define EXP   ((float64_t)(2.71828182845904523536L))
 
#define LN2   ((float64_t)(0.69314718055994506418L))
 
#define LN10   ((float64_t)(2.30258509299404590109L))
 
#define PI   ((float64_t)(3.14159265358979323846L))
 
#define PI_2   ((float64_t)(1.57079632679489661923L))
 
#define PI_1_2   ((float64_t)(0.318309886183790671538L))
 
#define PI_2_2   ((float64_t)(0.636619772367581343076L))
 
#define math_log2(n)   (math_log(n) / LN2)
 ! log2 of n
 
#define math_log10(n)   (math_log(n) / LN10)
 ! log10 of n
 
#define MATH_EXP_MASK   0x7FF0000000000000ULL
 ! exponent part of float64_t
 
#define MATH_FRAC_MASK   0x000FFFFFFFFFFFFFULL
 ! fraction part of float64_t
 

Functions

int64_t math_ceil (float64_t num)
 ceil of given float number More...
 
int64_t math_floor (float64_t num)
 floor of given float number More...
 
float64_t math_power (float64_t base, float64_t p)
 power base with p More...
 
float64_t math_exp (float64_t number)
 calculates exp^number More...
 
float64_t math_log (float64_t number)
 calculates log given number at base exp More...
 
float64_t math_antilog (float64_t power, float64_t base)
 calculates antilog value More...
 
float64_t math_root (float64_t number, float64_t root)
 calculates root of given number at root More...
 
float64_t math_sin (float64_t number)
 calculates sin of x More...
 
boolean_t math_isnan (float64_t number)
 checks if given number is nan More...
 
boolean_t math_isinf (float64_t number)
 checks if given number is infinite More...
 

Detailed Description

Math header.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Function Documentation

◆ math_antilog()

float64_t math_antilog ( float64_t  power,
float64_t  base 
)

calculates antilog value

Parameters
[in]powergiven number
[in]baselog base
Returns
antilog value base^power

◆ math_ceil()

int64_t math_ceil ( float64_t  num)

ceil of given float number

Parameters
[in]numgiven float number
Returns
ceiled value

◆ math_exp()

float64_t math_exp ( float64_t  number)

calculates exp^number

Parameters
[in]numbernumber to calculate
Returns
exp^number

◆ math_floor()

int64_t math_floor ( float64_t  num)

floor of given float number

Parameters
[in]numgiven float number
Returns
floored value

◆ math_isinf()

boolean_t math_isinf ( float64_t  number)

checks if given number is infinite

Parameters
[in]numbernumber for calculation
Returns
true if number is infinite

◆ math_isnan()

boolean_t math_isnan ( float64_t  number)

checks if given number is nan

Parameters
[in]numbernumber for calculation
Returns
true if number is nan

◆ math_log()

float64_t math_log ( float64_t  number)

calculates log given number at base exp

Parameters
[in]numbernumber to calculate
Returns
log value at base exp

◆ math_power()

float64_t math_power ( float64_t  base,
float64_t  p 
)

power base with p

Parameters
[in]basethe base
[in]pthe power
Returns
base^p with fast power algorithm

◆ math_root()

float64_t math_root ( float64_t  number,
float64_t  root 
)

calculates root of given number at root

Parameters
[in]numbergiven number
[in]rootroot to calculate
Returns
root result

◆ math_sin()

float64_t math_sin ( float64_t  number)

calculates sin of x

Parameters
[in]numbernumber for calculation
Returns
sin(number)