5 #define ABS(a) ((a) >= 0 ? (a) : -(a))
8 ({ __typeof__ (a) _a = (a); \
9 __typeof__ (b) _b = (b); \
13 ({ __typeof__ (a) _a = (a); \
14 __typeof__ (b) _b = (b); \
27 static inline float int2float(uint32_t i) {
33 static inline double int2double(uint64_t i) {
39 static inline bool is_nan(
float value) {
41 value_union.f = value;
43 int exponent = (value_union.i >> 23) & 0xFF;
44 int fraction = value_union.i & 0x7FFFFF;
46 return exponent == 0xFF && fraction != 0;
49 static inline bool is_inf(
float value) {
51 value_union.f = value;
53 unsigned int exponent = (value_union.i >> 23) & 0xFF;
54 unsigned int fraction = value_union.i & 0x7FFFFF;
56 return (exponent == 0xFF) && (fraction == 0);
59 static inline double floor(
double x) {
62 return intPart - (x < 0 && x != intPart);
65 static inline double ceil(
double x) {
68 return intPart + (x > 0 && x != intPart);
71 static inline double fabs(
double x) {
72 return (x < 0) ? -x : x;
75 #define PI 3.141592653589793
77 #define ASIN_STEPS 6000
78 #define ATAN_STEPS 6000
80 #define NAN int2float(0x7fc00000)
81 #define INFINITY int2float(0x7f800000)
83 double deg2rad(
double);
84 double rad2deg(
double);
92 double pow(
double base,
double exponent);
93 size_t ipow(
size_t val,
size_t exp);
95 double trapezoidal_rule(
double (*f)(
double),
double a,
double b,
unsigned int steps);
100 double asin(
double x);
101 double acos(
double x);
102 double atan(
double x);
104 double sqrt(
double x);
105 double cbrt(
double x);
106 double modf(
double value,
double* intPart);
Основные определения ядра