summaryrefslogtreecommitdiff
path: root/soh/include/libc/math.h
blob: 473ef112b903feb44d1ee2bea55a398b364acf0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef MATH_H
#define MATH_H

#include <libultraship/libultra.h>

#ifndef M_PI
#define M_PI 3.14159265358979323846f
#endif
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880f
#endif
#ifndef FLT_MAX
#define FLT_MAX 340282346638528859811704183484516925440.0f
#endif
#define SHT_MAX 32767.0f
#define SHT_MINV (1.0f / SHT_MAX)
#define DEGTORAD(x) (x * M_PI / 180.0f)

typedef union {
    struct {
        u32 hi;
        u32 lo;
    } word;

    f64 d;
} du;

typedef union {
    u32 i;
    f32 f;
} fu;

extern f32 __libm_qnan_f;

#endif