22#define M_PI 3.14159265358979323846
26#define RADIANS_PER_DEGREE 0.0174532925199432957692
29#if defined(WIN32) && !defined(NAN)
30static const uint32 nan[2] = {0xffffffff, 0x7fffffff};
32#define NAN (*(const float8 *) nan)
45 const char *type_name,
const char *orig_string);
47 const char *type_name,
const char *orig_string,
70#pragma warning(disable:4756)
80#pragma warning(default:4756)
88 return (
float4) (HUGE_VAL * HUGE_VAL);
105 return (
float8) (HUGE_VAL * HUGE_VAL);
117 return (
float4) (0.0 / 0.0);
125#if defined(NAN) && !(defined(__NetBSD__) && defined(__mips__))
130 return (
float8) (0.0 / 0.0);
149 result = val1 + val2;
150 if (
unlikely(isinf(result)) && !isinf(val1) && !isinf(val2))
161 result = val1 + val2;
162 if (
unlikely(isinf(result)) && !isinf(val1) && !isinf(val2))
173 result = val1 - val2;
174 if (
unlikely(isinf(result)) && !isinf(val1) && !isinf(val2))
185 result = val1 - val2;
186 if (
unlikely(isinf(result)) && !isinf(val1) && !isinf(val2))
197 result = val1 * val2;
198 if (
unlikely(isinf(result)) && !isinf(val1) && !isinf(val2))
200 if (
unlikely(result == 0.0f) && val1 != 0.0f && val2 != 0.0f)
211 result = val1 * val2;
212 if (
unlikely(isinf(result)) && !isinf(val1) && !isinf(val2))
214 if (
unlikely(result == 0.0) && val1 != 0.0 && val2 != 0.0)
225 if (
unlikely(val2 == 0.0f) && !isnan(val1))
227 result = val1 / val2;
228 if (
unlikely(isinf(result)) && !isinf(val1))
230 if (
unlikely(result == 0.0f) && val1 != 0.0f && !isinf(val2))
241 if (
unlikely(val2 == 0.0) && !isnan(val1))
243 result = val1 / val2;
244 if (
unlikely(isinf(result)) && !isinf(val1))
246 if (
unlikely(result == 0.0) && val1 != 0.0 && !isinf(val2))
263 return isnan(val1) ? isnan(val2) : !isnan(val2) && val1 == val2;
269 return isnan(val1) ? isnan(val2) : !isnan(val2) && val1 == val2;
275 return isnan(val1) ? !isnan(val2) : isnan(val2) || val1 != val2;
281 return isnan(val1) ? !isnan(val2) : isnan(val2) || val1 != val2;
287 return !isnan(val1) && (isnan(val2) || val1 < val2);
293 return !isnan(val1) && (isnan(val2) || val1 < val2);
299 return isnan(val2) || (!isnan(val1) && val1 <= val2);
305 return isnan(val2) || (!isnan(val1) && val1 <= val2);
311 return !isnan(val2) && (isnan(val1) || val1 > val2);
317 return !isnan(val2) && (isnan(val1) || val1 > val2);
323 return isnan(val1) || (!isnan(val2) && val1 >= val2);
329 return isnan(val1) || (!isnan(val2) && val1 >= val2);
335 return float4_lt(val1, val2) ? val1 : val2;
341 return float8_lt(val1, val2) ? val1 : val2;
347 return float4_gt(val1, val2) ? val1 : val2;
353 return float8_gt(val1, val2) ? val1 : val2;
#define pg_attribute_noreturn()
Definition: c.h:180
#define PGDLLIMPORT
Definition: c.h:1321
double float8
Definition: c.h:570
#define unlikely(x)
Definition: c.h:274
float float4
Definition: c.h:569
float8 float8in_internal(char *num, char **endptr_p, const char *type_name, const char *orig_string)
static float8 float8_min(const float8 val1, const float8 val2)
Definition: float.h:339
static float8 float8_mul(const float8 val1, const float8 val2)
Definition: float.h:207
static float4 float4_div(const float4 val1, const float4 val2)
Definition: float.h:221
void float_overflow_error(void) pg_attribute_noreturn()
Definition: float.c:40
static float4 get_float4_infinity(void)
Definition: float.h:73
PGDLLIMPORT int extra_float_digits
Definition: float.c:30
static bool float4_lt(const float4 val1, const float4 val2)
Definition: float.h:285
static float8 float8_pl(const float8 val1, const float8 val2)
Definition: float.h:157
static float8 float8_mi(const float8 val1, const float8 val2)
Definition: float.h:181
static bool float4_ge(const float4 val1, const float4 val2)
Definition: float.h:321
static float4 get_float4_nan(void)
Definition: float.h:110
int is_infinite(float8 val)
void float_underflow_error(void) pg_attribute_noreturn()
Definition: float.c:46
static bool float8_ne(const float8 val1, const float8 val2)
Definition: float.h:279
static bool float4_ne(const float4 val1, const float4 val2)
Definition: float.h:273
static float4 float4_pl(const float4 val1, const float4 val2)
Definition: float.h:145
static float4 float4_max(const float4 val1, const float4 val2)
Definition: float.h:345
static bool float4_eq(const float4 val1, const float4 val2)
Definition: float.h:261
void float_zero_divide_error(void) pg_attribute_noreturn()
Definition: float.c:52
static float4 float4_mul(const float4 val1, const float4 val2)
Definition: float.h:193
static float8 get_float8_infinity(void)
Definition: float.h:93
static bool float8_ge(const float8 val1, const float8 val2)
Definition: float.h:327
int float4_cmp_internal(float4 a, float4 b)
char * float8out_internal(float8 num)
static float4 float4_mi(const float4 val1, const float4 val2)
Definition: float.h:169
static float8 float8_max(const float8 val1, const float8 val2)
Definition: float.h:351
static bool float8_le(const float8 val1, const float8 val2)
Definition: float.h:303
static bool float4_gt(const float4 val1, const float4 val2)
Definition: float.h:309
static bool float8_eq(const float8 val1, const float8 val2)
Definition: float.h:267
static float4 float4_min(const float4 val1, const float4 val2)
Definition: float.h:333
static bool float4_le(const float4 val1, const float4 val2)
Definition: float.h:297
static float8 get_float8_nan(void)
Definition: float.h:122
static float8 float8_div(const float8 val1, const float8 val2)
Definition: float.h:237
float8 float8in_internal_opt_error(char *num, char **endptr_p, const char *type_name, const char *orig_string, bool *have_error)
static bool float8_lt(const float8 val1, const float8 val2)
Definition: float.h:291
static bool float8_gt(const float8 val1, const float8 val2)
Definition: float.h:315
int float8_cmp_internal(float8 a, float8 b)
Definition: float.c:61
unsigned int uint32
Definition: pg_ext_defs.in.h:13