2023-10-23 15:02:01 -05:00
|
|
|
#ifndef LIBC_MATH_H
|
|
|
|
#define LIBC_MATH_H
|
|
|
|
|
2024-03-24 02:01:28 -06:00
|
|
|
#include <libultra/types.h>
|
2024-04-01 23:13:52 -06:00
|
|
|
#include <math.h>
|
2023-10-23 15:02:01 -05:00
|
|
|
|
2024-05-21 18:34:27 -06:00
|
|
|
#define M_PI 3.14159265358979323846f
|
2023-10-23 15:02:01 -05:00
|
|
|
#define M_DTOR (M_PI / 180.0f)
|
2023-11-12 16:49:03 -06:00
|
|
|
#define M_RTOD (180.0f / M_PI)
|
2023-10-23 15:02:01 -05:00
|
|
|
#define M_SQRT2 1.41421356237309504880f
|
|
|
|
#define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
|
|
|
|
#define FLT_MAX 340282346638528859811704183484516925440.0f
|
|
|
|
#define SHT_MAX 32767.0f
|
|
|
|
#define SHT_MINV (1.0f / SHT_MAX)
|
|
|
|
|
2024-05-21 18:34:27 -06:00
|
|
|
typedef union {
|
|
|
|
struct {
|
|
|
|
u32 hi;
|
|
|
|
u32 lo;
|
|
|
|
} word;
|
|
|
|
|
|
|
|
f64 d;
|
|
|
|
} du;
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
u32 i;
|
|
|
|
f32 f;
|
|
|
|
} fu;
|
|
|
|
|
2024-03-24 02:01:28 -06:00
|
|
|
#define __floorf floorf
|
|
|
|
#define __floor floor
|
|
|
|
#define __lfloorf lfloorf
|
|
|
|
#define __lfloor lfloor
|
|
|
|
#define __ceilf ceilf
|
|
|
|
#define __ceil ceil
|
|
|
|
#define __lceilf lceilf
|
|
|
|
#define __lceil lceil
|
|
|
|
#define __truncf truncf
|
|
|
|
#define __trunc trunc
|
|
|
|
#define __ltruncf ltruncf
|
|
|
|
#define __ltrunc ltrunc
|
|
|
|
#define __roundf roundf
|
|
|
|
#define __round round
|
|
|
|
#define __lroundf lroundf
|
|
|
|
#define __lround lround
|
|
|
|
#define __nearbyintf nearbyintf
|
|
|
|
#define __nearbyint nearbyint
|
|
|
|
#define __lnearbyintf lnearbyintf
|
|
|
|
#define __lnearbyint lnearbyint
|
2024-02-16 16:04:22 -06:00
|
|
|
|
2024-10-16 11:53:41 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
f32 __sinf(f32);
|
|
|
|
f32 __cosf(f32);
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2024-04-03 09:57:24 -06:00
|
|
|
|
2023-10-23 15:02:01 -05:00
|
|
|
#endif
|