Banjo API 0.0.1
C99 game development API
Loading...
Searching...
No Matches
math.h File Reference
#include <math.h>
#include <float.h>
Include dependency graph for math.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

Circle constants
#define BJ_PI_F   (3.14159265358979323846f)
#define BJ_TAU_F   (6.28318530717958647692f)
#define BJ_PI_D   (3.14159265358979323846264338327950288)
#define BJ_TAU_D   (6.28318530717958647692528676655900576)
#define BJ_PI_L   (3.141592653589793238462643383279502884L)
#define BJ_TAU_L   (6.283185307179586476925286766559005768L)
#define BJ_PI   (BJ_F(3.141592653589793238462643383279502884))
#define BJ_TAU   (BJ_F(6.283185307179586476925286766559005768))
Typed wrappers (float)

Thin aliases to <math.h> float functions.

#define bj_absf   fabsf
#define bj_acosf   acosf
#define bj_atan2f   atan2f
#define bj_copysignf   copysignf
#define bj_cosf   cosf
#define bj_expf   expf
#define bj_floorf   floorf
#define bj_fmodf   fmodf
#define bj_logf   logf
#define bj_maxf   fmaxf
#define bj_minf   fminf
#define bj_powf   powf
#define bj_roundf   roundf
#define bj_sinf   sinf
#define bj_sqrtf   sqrtf
#define bj_tanf   tanf
Typed wrappers (double)

Thin aliases to <math.h> double functions.

#define bj_absd   fabs
#define bj_acosd   acos
#define bj_atan2d   atan2
#define bj_copysignd   copysign
#define bj_cosd   cos
#define bj_expd   exp
#define bj_floord   floor
#define bj_fmodd   fmod
#define bj_logd   log
#define bj_maxd   fmax
#define bj_mind   fmin
#define bj_powd   pow
#define bj_roundd   round
#define bj_sind   sin
#define bj_sqrtd   sqrt
#define bj_tand   tan
Typed wrappers (long double)

Thin aliases to <math.h> long double functions.

#define bj_absl   fabsl
#define bj_acosl   acosl
#define bj_atan2l   atan2l
#define bj_copysignl   copysignl
#define bj_cosl   cosl
#define bj_expl   expl
#define bj_floorl   floorl
#define bj_fmodl   fmodl
#define bj_logl   logl
#define bj_maxl   fmaxl
#define bj_minl   fminl
#define bj_powl   powl
#define bj_roundl   roundl
#define bj_sinl   sinl
#define bj_sqrtl   sqrtl
#define bj_tanl   tanl
Precision-dispatch to match bj_real

Map generic bj_* names to the active precision.

#define bj_abs   bj_absf
#define bj_acos   bj_acosf
#define bj_atan2   bj_atan2f
#define bj_copysign   bj_copysignf
#define bj_cos   bj_cosf
#define bj_exp   bj_expf
#define bj_floor   bj_floorf
#define bj_fmod   bj_fmodf
#define bj_log   bj_logf
#define bj_max   bj_maxf
#define bj_min   bj_minf
#define bj_pow   bj_powf
#define bj_round   bj_roundf
#define bj_sin   bj_sinf
#define bj_sqrt   bj_sqrtf
#define bj_tan   bj_tanf

Functions

Scalar utilities

Generic scalar helpers.

All arguments and results are bj_real.

static bj_real bj_clamp (bj_real x, bj_real lo, bj_real hi)
static bj_real bj_step (bj_real edge, bj_real x)
static bj_real bj_smoothstep (bj_real e0, bj_real e1, bj_real x)
static bj_real bj_fract (bj_real x)
static bj_real bj_mod (bj_real x, bj_real y)
Absolute-epsilon comparisons

Comparisons using BJ_EPSILON as an absolute tolerance.

static int bj_real_eq (bj_real a, bj_real b)
static int bj_real_neq (bj_real a, bj_real b)
static int bj_real_lt (bj_real a, bj_real b)
static int bj_real_gt (bj_real a, bj_real b)
static int bj_real_lte (bj_real a, bj_real b)
static int bj_real_gte (bj_real a, bj_real b)
static int bj_real_cmp (bj_real a, bj_real b)
Relative-epsilon comparisons

Comparisons using a scale-dependent tolerance.

static bj_real bj_real_relative_scale (bj_real a, bj_real b)
static int bj_real_eq_rel (bj_real a, bj_real b)
static int bj_real_neq_rel (bj_real a, bj_real b)
static int bj_real_lt_rel (bj_real a, bj_real b)
static int bj_real_gt_rel (bj_real a, bj_real b)
static int bj_real_lte_rel (bj_real a, bj_real b)
static int bj_real_gte_rel (bj_real a, bj_real b)
static int bj_real_cmp_rel (bj_real a, bj_real b)
Zero tests and helpers

Utilities for zero checks and safe normalization.

static int bj_real_is_zero (bj_real x)
static int bj_real_is_zero_scaled (bj_real x, bj_real scale)
static bj_real bj_real_snap_zero (bj_real x)
static bj_real bj_real_snorm_safe (bj_real x, bj_real len)

Real type selection and helpers

#define BJ_F(x)
#define BJ_EPSILON   (FLT_EPSILON)
#define BJ_FI(x)
#define BJ_FZERO   (BJ_F(0.0))
typedef float bj_real

Detailed Description

C99 math shim with bj_real precision type and scalar utilities.