Gama C Library
Gama C API Documentation
math.h File Reference

Go to the source code of this file.

Data Structures

struct  special

Macros

#define GM_MATH
#define PI   3.14159265358979324
 The mathematical constant Pi (π).
#define M_PI   PI
 Alias for the mathematical constant Pi (π).
#define EPS   1e-17
 A small epsilon value used for floating-point comparisons.
#define ln10   2.30258509299404590109
 The natural logarithm of 10.
#define INF   1.0 / 0.0
 Represents positive infinity for double-precision floating-point numbers.
#define NAN   0.0 / 0.0
 Represents "Not a Number" for double-precision floating-point numbers.
#define MAX_double   1.7976931348623158e308
 The maximum representable value for a double-precision floating-point number.

Functions

double tan (double x)
 Calculates the tangent of an angle (in radians).
double cos (double x)
 Calculates the cosine of an angle (in radians).
double sin (double x)
 Calculates the sine of an angle (in radians).
double ceil (double x)
 Calculates the smallest integer value greater than or equal to x.
double floor (double x)
 Calculates the largest integer value less than or equal to x.
double atan (double x)
 Calculates the arctangent of x.
double acos (double x)
 Calculates the arccosine of x.
double asin (double x)
 Calculates the arcsine of x.
double fmod (double x, double y)
 Calculates the floating-point remainder of x/y.
double exp (double x)
 Calculates the base-e exponential of x (e^x).
double log (double x)
 Calculates the natural logarithm of x (ln(x)).
double sqrt (double x)
 Calculates the square root of x.
double pow (double base, double vexp)
 Calculates the base raised to the power of the exponent (base^exp).
double fabs (double x)
 Calculates the absolute value of a double.
void translate (double x, struct special *_special)
double atan_1_1 (double x)
double delete (double x)
double log_other (double x)
double log_0_2 (double x)
int min (int a, int b)
 Returns the smaller of two integer values.
double fmin (double a, double b)
 Returns the smaller of two double values.
int max (int a, int b)
 Returns the larger of two integer values.
double fmax (double a, double b)
 Returns the larger of two double values.

Macro Definition Documentation

◆ EPS

#define EPS   1e-17

A small epsilon value used for floating-point comparisons.

◆ GM_MATH

#define GM_MATH

◆ INF

#define INF   1.0 / 0.0

Represents positive infinity for double-precision floating-point numbers.

◆ ln10

#define ln10   2.30258509299404590109

The natural logarithm of 10.

◆ M_PI

#define M_PI   PI

Alias for the mathematical constant Pi (π).

◆ MAX_double

#define MAX_double   1.7976931348623158e308

The maximum representable value for a double-precision floating-point number.

◆ NAN

#define NAN   0.0 / 0.0

Represents "Not a Number" for double-precision floating-point numbers.

◆ PI

#define PI   3.14159265358979324

The mathematical constant Pi (π).

Function Documentation

◆ acos()

double acos ( double x)

Calculates the arccosine of x.

Parameters
xThe floating-point value, expected to be in the range [-1, 1].
Returns
The arccosine of x in radians, in the range [0, PI], or NAN if x is out of range.

◆ asin()

double asin ( double x)

Calculates the arcsine of x.

Parameters
xThe floating-point value, expected to be in the range [-1, 1].
Returns
The arcsine of x in radians, in the range [-PI/2, PI/2], or NAN if x is out of range.

◆ atan()

double atan ( double x)

Calculates the arctangent of x.

Parameters
xThe floating-point value.
Returns
The arctangent of x in radians, in the range [-PI/2, PI/2].

◆ atan_1_1()

double atan_1_1 ( double x)

◆ ceil()

double ceil ( double x)

Calculates the smallest integer value greater than or equal to x.

Parameters
xThe floating-point value.
Returns
The ceiling of x.

◆ cos()

double cos ( double x)

Calculates the cosine of an angle (in radians).

Parameters
xThe angle in radians.
Returns
The cosine of x.

◆ delete()

double delete ( double x)

◆ exp()

double exp ( double x)

Calculates the base-e exponential of x (e^x).

Parameters
xThe exponent.
Returns
The value of e raised to the power of x.

◆ fabs()

double fabs ( double x)

Calculates the absolute value of a double.

Parameters
xThe floating-point value.
Returns
The absolute value of x.

◆ floor()

double floor ( double x)

Calculates the largest integer value less than or equal to x.

Parameters
xThe floating-point value.
Returns
The floor of x.

◆ fmax()

double fmax ( double a,
double b )

Returns the larger of two double values.

Parameters
aThe first double.
bThe second double.
Returns
The larger of a and b.

◆ fmin()

double fmin ( double a,
double b )

Returns the smaller of two double values.

Parameters
aThe first double.
bThe second double.
Returns
The smaller of a and b.

◆ fmod()

double fmod ( double x,
double y )

Calculates the floating-point remainder of x/y.

Parameters
xThe numerator.
yThe denominator.
Returns
The remainder with the same sign as x.

◆ log()

double log ( double x)

Calculates the natural logarithm of x (ln(x)).

Parameters
xThe floating-point value.
Returns
The natural logarithm of x, or NAN if x is negative, or -INF if x is zero.

◆ log_0_2()

double log_0_2 ( double x)

◆ log_other()

double log_other ( double x)

◆ max()

int max ( int a,
int b )

Returns the larger of two integer values.

Parameters
aThe first integer.
bThe second integer.
Returns
The larger of a and b.

◆ min()

int min ( int a,
int b )

Returns the smaller of two integer values.

Parameters
aThe first integer.
bThe second integer.
Returns
The smaller of a and b.

◆ pow()

double pow ( double base,
double vexp )

Calculates the base raised to the power of the exponent (base^exp).

Parameters
baseThe base value.
vexpThe exponent value.
Returns
The result of base raised to the power of exp.

◆ sin()

double sin ( double x)

Calculates the sine of an angle (in radians).

Parameters
xThe angle in radians.
Returns
The sine of x.

◆ sqrt()

double sqrt ( double x)

Calculates the square root of x.

Parameters
xThe non-negative floating-point value.
Returns
The square root of x, or NAN if x is negative.

◆ tan()

double tan ( double x)

Calculates the tangent of an angle (in radians).

Parameters
xThe angle in radians.
Returns
The tangent of x, or NAN if x is an odd multiple of PI/2.

◆ translate()

void translate ( double x,
struct special * _special )