PostgreSQL Source Code: src/backend/utils/adt/float.c File Reference (original) (raw)
#include "[postgres.h](postgres%5F8h%5Fsource.html)"#include <ctype.h>#include <[float.h](float%5F8h%5Fsource.html)>#include <math.h>#include <limits.h>#include "[catalog/pg_type.h](pg%5F%5Ftype%5F8h%5Fsource.html)"#include "[common/int.h](int%5F8h%5Fsource.html)"#include "[common/shortest_dec.h](shortest%5F%5Fdec%5F8h%5Fsource.html)"#include "[libpq/pqformat.h](pqformat%5F8h%5Fsource.html)"#include "[utils/array.h](array%5F8h%5Fsource.html)"#include "utils/fmgrprotos.h"#include "[utils/sortsupport.h](sortsupport%5F8h%5Fsource.html)"

Go to the source code of this file.
| Variables | |
|---|---|
| int | extra_float_digits = 1 |
| static bool | degree_consts_set = false |
| static float8 | sin_30 = 0 |
| static float8 | one_minus_cos_60 = 0 |
| static float8 | asin_0_5 = 0 |
| static float8 | acos_0_5 = 0 |
| static float8 | atan_1_0 = 0 |
| static float8 | tan_45 = 0 |
| static float8 | cot_45 = 0 |
| float8 | degree_c_thirty = 30.0 |
| float8 | degree_c_forty_five = 45.0 |
| float8 | degree_c_sixty = 60.0 |
| float8 | degree_c_one_half = 0.5 |
| float8 | degree_c_one = 1.0 |
◆ INIT_DEGREE_CONSTANTS
| #define INIT_DEGREE_CONSTANTS | ( | ) |
|---|
Value:
do { \
} while(0)
static bool degree_consts_set
Definition at line 2031 of file float.c.
◆ acosd_q1()
Definition at line 2081 of file float.c.
2082{
2083
2084
2085
2086
2087
2088
2089 if (x <= 0.5)
2090 {
2092
2094 }
2095 else
2096 {
2098
2100 }
2101}
References acos_0_5, asin_0_5, fb(), and x.
Referenced by dacosd().
◆ asind_q1()
◆ btfloat48cmp()
◆ btfloat4cmp()
◆ btfloat4fastcmp()
◆ btfloat4sortsupport()
◆ btfloat84cmp()
◆ btfloat8cmp()
◆ btfloat8fastcmp()
◆ btfloat8sortsupport()
◆ check_float8_array()
Definition at line 2933 of file float.c.
2934{
2935
2936
2937
2938
2939
2944 elog(ERROR, "%s: expected %d-element float8 array", caller, n);
2946}
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, elog, ERROR, and fb().
Referenced by float4_accum(), float8_accum(), float8_avg(), float8_combine(), float8_corr(), float8_covar_pop(), float8_covar_samp(), float8_regr_accum(), float8_regr_avgx(), float8_regr_avgy(), float8_regr_combine(), float8_regr_intercept(), float8_regr_r2(), float8_regr_slope(), float8_regr_sxx(), float8_regr_sxy(), float8_regr_syy(), float8_stddev_pop(), float8_stddev_samp(), float8_var_pop(), and float8_var_samp().
◆ cosd_0_to_60()
◆ cosd_q1()
◆ dacos()
Definition at line 1755 of file float.c.
1756{
1759
1760
1763
1764
1765
1766
1767
1768
1772 errmsg("input is out of range")));
1773
1777
1779}
int errcode(int sqlerrcode)
#define ereport(elevel,...)
pg_noinline void float_overflow_error(void)
static float8 get_float8_nan(void)
#define PG_RETURN_FLOAT8(x)
References ereport, errcode(), errmsg, ERROR, fb(), float_overflow_error(), get_float8_nan(), PG_GETARG_FLOAT8, PG_RETURN_FLOAT8, and unlikely.
◆ dacosd()
Definition at line 2108 of file float.c.
2109{
2112
2113
2116
2118
2119
2120
2121
2122
2123
2127 errmsg("input is out of range")));
2128
2129 if (arg1 >= 0.0)
2131 else
2133
2136
2138}
static double acosd_q1(double x)
static double asind_q1(double x)
#define INIT_DEGREE_CONSTANTS()
References acosd_q1(), asind_q1(), ereport, errcode(), errmsg, ERROR, fb(), float_overflow_error(), get_float8_nan(), INIT_DEGREE_CONSTANTS, PG_GETARG_FLOAT8, PG_RETURN_FLOAT8, and unlikely.
◆ dacosh()
◆ dasin()
◆ dasind()
Definition at line 2145 of file float.c.
2146{
2149
2150
2153
2155
2156
2157
2158
2159
2160
2164 errmsg("input is out of range")));
2165
2166 if (arg1 >= 0.0)
2168 else
2170
2173
2175}
References asind_q1(), ereport, errcode(), errmsg, ERROR, fb(), float_overflow_error(), get_float8_nan(), INIT_DEGREE_CONSTANTS, PG_GETARG_FLOAT8, PG_RETURN_FLOAT8, and unlikely.
◆ dasinh()
◆ datan()
◆ datan2()
◆ datan2d()
◆ datand()
◆ datanh()
◆ dcbrt()
◆ dceil()
◆ dcos()
◆ dcosd()
Definition at line 2318 of file float.c.
2319{
2322 int sign = 1;
2323
2324
2325
2326
2327
2330
2334 errmsg("input is out of range")));
2335
2337
2338
2340
2341 if (arg1 < 0.0)
2342 {
2343
2345 }
2346
2347 if (arg1 > 180.0)
2348 {
2349
2351 }
2352
2353 if (arg1 > 90.0)
2354 {
2355
2358 }
2359
2361
2364
2366}
static double cosd_q1(double x)
References cosd_q1(), ereport, errcode(), errmsg, ERROR, fb(), float_overflow_error(), get_float8_nan(), INIT_DEGREE_CONSTANTS, PG_GETARG_FLOAT8, PG_RETURN_FLOAT8, sign, and unlikely.
◆ dcosh()
◆ dcot()
◆ dcotd()
Definition at line 2373 of file float.c.
2374{
2378 int sign = 1;
2379
2380
2381
2382
2383
2386
2390 errmsg("input is out of range")));
2391
2393
2394
2396
2397 if (arg1 < 0.0)
2398 {
2399
2402 }
2403
2404 if (arg1 > 180.0)
2405 {
2406
2409 }
2410
2411 if (arg1 > 90.0)
2412 {
2413
2416 }
2417
2420
2421
2422
2423
2424
2425
2426 if (result == 0.0)
2427 result = 0.0;
2428
2429
2430
2432}
static double sind_q1(double x)
References cosd_q1(), cot_45, ereport, errcode(), errmsg, ERROR, fb(), get_float8_nan(), INIT_DEGREE_CONSTANTS, PG_GETARG_FLOAT8, PG_RETURN_FLOAT8, sign, and sind_q1().
◆ degrees()
◆ derf()
◆ derfc()
◆ dexp()
◆ dfloor()
◆ dgamma()
◆ dlgamma()
◆ dlog1()
◆ dlog10()
◆ dpi()
◆ dpow()
Definition at line 1489 of file float.c.
1490{
1494
1495
1496
1497
1498
1499
1500
1502 {
1506 }
1508 {
1509 if (arg1 != 1.0)
1512 }
1513
1514
1515
1516
1517
1518
1522 errmsg("zero raised to a negative power is undefined")));
1526 errmsg("a negative number raised to a non-integer power yields a complex result")));
1527
1528
1529
1530
1531
1532
1534 {
1536
1537 if (absx == 1.0)
1538 result = 1.0;
1539 else if (arg2 > 0.0)
1540 {
1541 if (absx > 1.0)
1542 result = arg2;
1543 else
1544 result = 0.0;
1545 }
1546 else
1547 {
1548 if (absx > 1.0)
1549 result = 0.0;
1550 else
1551 result = -arg2;
1552 }
1553 }
1555 {
1556 if (arg2 == 0.0)
1557 result = 1.0;
1558 else if (arg1 > 0.0)
1559 {
1560 if (arg2 > 0.0)
1561 result = arg1;
1562 else
1563 result = 0.0;
1564 }
1565 else
1566 {
1567
1568
1569
1570
1571
1572
1575
1576 if (arg2 > 0.0)
1578 else
1580 }
1581 }
1582 else
1583 {
1584
1585
1586
1587
1588
1589
1590
1594 {
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606 if (arg1 == 0.0)
1607 result = 0.0;
1608 else
1609 {
1611
1612 if (absx == 1.0)
1613 result = 1.0;
1614 else if (arg2 >= 0.0 ? (absx > 1.0) : (absx < 1.0))
1616 else
1618 }
1619 }
1621 {
1622 if (result != 0.0)
1624 else
1626 }
1627 else
1628 {
1633 }
1634 }
1635
1637}
References ereport, errcode(), errmsg, ERROR, fb(), float_overflow_error(), float_underflow_error(), get_float8_nan(), PG_GETARG_FLOAT8, PG_RETURN_FLOAT8, and unlikely.
◆ dround()
◆ dsign()
◆ dsin()
◆ dsind()
Definition at line 2439 of file float.c.
2440{
2443 int sign = 1;
2444
2445
2446
2447
2448
2451
2455 errmsg("input is out of range")));
2456
2458
2459
2461
2462 if (arg1 < 0.0)
2463 {
2464
2467 }
2468
2469 if (arg1 > 180.0)
2470 {
2471
2474 }
2475
2476 if (arg1 > 90.0)
2477 {
2478
2480 }
2481
2483
2486
2488}
References ereport, errcode(), errmsg, ERROR, fb(), float_overflow_error(), get_float8_nan(), INIT_DEGREE_CONSTANTS, PG_GETARG_FLOAT8, PG_RETURN_FLOAT8, sign, sind_q1(), and unlikely.
◆ dsinh()
◆ dsqrt()
◆ dtan()
◆ dtand()
Definition at line 2495 of file float.c.
2496{
2500 int sign = 1;
2501
2502
2503
2504
2505
2508
2512 errmsg("input is out of range")));
2513
2515
2516
2518
2519 if (arg1 < 0.0)
2520 {
2521
2524 }
2525
2526 if (arg1 > 180.0)
2527 {
2528
2531 }
2532
2533 if (arg1 > 90.0)
2534 {
2535
2538 }
2539
2542
2543
2544
2545
2546
2547
2548 if (result == 0.0)
2549 result = 0.0;
2550
2551
2552
2554}
References cosd_q1(), ereport, errcode(), errmsg, ERROR, fb(), get_float8_nan(), INIT_DEGREE_CONSTANTS, PG_GETARG_FLOAT8, PG_RETURN_FLOAT8, sign, sind_q1(), and tan_45.
◆ dtanh()
◆ dtof()
◆ dtoi2()
◆ dtoi4()
◆ dtrunc()
◆ float48div()
◆ float48eq()
◆ float48ge()
◆ float48gt()
◆ float48le()
◆ float48lt()
◆ float48mi()
◆ float48mul()
◆ float48ne()
◆ float48pl()
◆ float4_accum()
Definition at line 3130 of file float.c.
3131{
3133
3134
3140 tmp;
3141
3146
3147
3148
3149
3150
3151 N += 1.0;
3154 {
3157
3158
3159
3160
3161
3162
3163
3165 {
3168
3170 }
3171 }
3172 else
3173 {
3174
3175
3176
3177
3178
3179
3182 }
3183
3184
3185
3186
3187
3188
3190 {
3194
3196 }
3197 else
3198 {
3201
3205
3207
3209 }
3210}
#define PG_GETARG_ARRAYTYPE_P(n)
#define PG_RETURN_ARRAYTYPE_P(x)
ArrayType * construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
static float8 * check_float8_array(ArrayType *transarray, const char *caller, int n)
int AggCheckCallContext(FunctionCallInfo fcinfo, MemoryContext *aggcontext)
#define Float8GetDatumFast(X)
References AggCheckCallContext(), check_float8_array(), construct_array_builtin(), fb(), Float8GetDatumFast, float_overflow_error(), get_float8_nan(), newval, PG_GETARG_ARRAYTYPE_P, PG_GETARG_FLOAT4, and PG_RETURN_ARRAYTYPE_P.
◆ float4_cmp_internal()
◆ float4abs()
◆ float4div()
◆ float4eq()
◆ float4ge()
◆ float4gt()
◆ float4in()
◆ float4in_internal()
Definition at line 183 of file float.c.
186{
187 float val;
188 char *endptr;
189
190
191
192
193
194
195
196
197 while (*num != '\0' && isspace((unsigned char) *num))
198 num++;
199
200
201
202
203
204 if (*num == '\0')
207 errmsg("invalid input syntax for type %s: \"%s\"",
209
212
213
214 if (endptr == num || errno != 0)
215 {
217
218
219
220
221
222
223
224
225
226
227
229 {
231 endptr = num + 3;
232 }
234 {
236 endptr = num + 8;
237 }
239 {
241 endptr = num + 9;
242 }
244 {
246 endptr = num + 9;
247 }
249 {
251 endptr = num + 3;
252 }
254 {
256 endptr = num + 4;
257 }
259 {
261 endptr = num + 4;
262 }
264 {
265
266
267
268
269
270
271
272 if (val == 0.0 ||
275#else
278 )
279 {
280
282
284
287 errmsg("\"%s\" is out of range for type real",
289 }
290 }
291 else
294 errmsg("invalid input syntax for type %s: \"%s\"",
296 }
297
298
299 while (*endptr != '\0' && isspace((unsigned char) *endptr))
300 endptr++;
301
302
305 else if (*endptr != '\0')
308 errmsg("invalid input syntax for type %s: \"%s\"",
310
311 return val;
312}
#define ereturn(context, dummy_value,...)
static float4 get_float4_infinity(void)
static float4 get_float4_nan(void)
char * pstrdup(const char *in)
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
References ereturn, errcode(), errmsg, fb(), get_float4_infinity(), get_float4_nan(), pg_strncasecmp(), pstrdup(), and val.
Referenced by float4in().
◆ float4larger()
◆ float4le()
◆ float4lt()
◆ float4mi()
◆ float4mul()
◆ float4ne()
◆ float4out()
Definition at line 319 of file float.c.
320{
324
326 {
329 }
330
333}
int float_to_shortest_decimal_buf(float f, char *result)
#define PG_RETURN_CSTRING(x)
Datum ascii(PG_FUNCTION_ARGS)
int pg_strfromd(char *str, size_t count, int precision, double value)
References ascii(), extra_float_digits, fb(), float_to_shortest_decimal_buf(), palloc(), PG_GETARG_FLOAT4, PG_RETURN_CSTRING, and pg_strfromd().
◆ float4pl()
◆ float4recv()
◆ float4send()
◆ float4smaller()
◆ float4um()
◆ float4up()
◆ float84div()
◆ float84eq()
◆ float84ge()
◆ float84gt()
◆ float84le()
◆ float84lt()
◆ float84mi()
◆ float84mul()
◆ float84ne()
◆ float84pl()
◆ float8_accum()
Definition at line 3049 of file float.c.
3050{
3057 tmp;
3058
3063
3064
3065
3066
3067
3068 N += 1.0;
3071 {
3074
3075
3076
3077
3078
3079
3080
3082 {
3085
3087 }
3088 }
3089 else
3090 {
3091
3092
3093
3094
3095
3096
3099 }
3100
3101
3102
3103
3104
3105
3107 {
3111
3113 }
3114 else
3115 {
3118
3122
3124
3126 }
3127}
References AggCheckCallContext(), check_float8_array(), construct_array_builtin(), fb(), Float8GetDatumFast, float_overflow_error(), get_float8_nan(), newval, PG_GETARG_ARRAYTYPE_P, PG_GETARG_FLOAT8, and PG_RETURN_ARRAYTYPE_P.
◆ float8_avg()
◆ float8_cmp_internal()
Definition at line 910 of file float.c.
911{
913 return 1;
915 return -1;
916 return 0;
917}
References a, b, float8_gt(), and float8_lt().
Referenced by btfloat48cmp(), btfloat84cmp(), btfloat8cmp(), btfloat8fastcmp(), common_entry_cmp(), gbt_float8_ssup_cmp(), interval_cmp_lower(), interval_cmp_upper(), and pairingheap_GISTSearchItem_cmp().
◆ float8_combine()
Definition at line 2957 of file float.c.
2958{
2969 tmp,
2970 N,
2973
2976
2980
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998 if (N1 == 0.0)
2999 {
3000 N = N2;
3003 }
3004 else if (N2 == 0.0)
3005 {
3006 N = N1;
3009 }
3010 else
3011 {
3018 }
3019
3020
3021
3022
3023
3024
3026 {
3030
3032 }
3033 else
3034 {
3037
3041
3043
3045 }
3046}
References AggCheckCallContext(), check_float8_array(), construct_array_builtin(), fb(), float8_pl(), Float8GetDatumFast, float_overflow_error(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, and unlikely.
◆ float8_corr()
◆ float8_covar_pop()
◆ float8_covar_samp()
◆ float8_regr_accum()
Definition at line 3354 of file float.c.
3355{
3371
3381
3382
3383
3384
3385
3386 N += 1.0;
3390 {
3391
3392
3393
3394
3395
3400
3404
3405
3406
3407
3408
3409
3410
3411
3418
3419
3420
3421
3422
3423
3424
3426 {
3435
3442 }
3443 }
3444 else
3445 {
3446
3447
3448
3449
3450
3451
3456
3459 }
3460
3461
3462
3463
3464
3465
3467 {
3476
3478 }
3479 else
3480 {
3483
3492
3494
3496 }
3497}
References AggCheckCallContext(), check_float8_array(), construct_array_builtin(), fb(), Float8GetDatumFast, float_overflow_error(), get_float8_nan(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_FLOAT8, PG_RETURN_ARRAYTYPE_P, and scale.
◆ float8_regr_avgx()
◆ float8_regr_avgy()
◆ float8_regr_combine()
Definition at line 3508 of file float.c.
3509{
3532 N,
3540
3543
3552
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578 if (N1 == 0.0)
3579 {
3580 N = N2;
3588 }
3589 else if (N2 == 0.0)
3590 {
3591 N = N1;
3599 }
3600 else
3601 {
3618 else
3622 else
3624 }
3625
3626
3627
3628
3629
3630
3632 {
3641
3643 }
3644 else
3645 {
3648
3657
3659
3661 }
3662}
References AggCheckCallContext(), check_float8_array(), construct_array_builtin(), fb(), float8_eq(), float8_pl(), Float8GetDatumFast, float_overflow_error(), get_float8_nan(), PG_GETARG_ARRAYTYPE_P, PG_RETURN_ARRAYTYPE_P, and unlikely.
◆ float8_regr_intercept()
◆ float8_regr_r2()
◆ float8_regr_slope()
◆ float8_regr_sxx()
◆ float8_regr_sxy()
◆ float8_regr_syy()
◆ float8_stddev_pop()
◆ float8_stddev_samp()
◆ float8_var_pop()
◆ float8_var_samp()
◆ float8abs()
◆ float8div()
◆ float8eq()
◆ float8ge()
◆ float8gt()
◆ float8in()
◆ float8in_internal()
Definition at line 395 of file float.c.
398{
399 double val;
400 char *endptr;
401
402
403 while (*num != '\0' && isspace((unsigned char) *num))
404 num++;
405
406
407
408
409
410 if (*num == '\0')
413 errmsg("invalid input syntax for type %s: \"%s\"",
415
418
419
420 if (endptr == num || errno != 0)
421 {
423
424
425
426
427
428
429
430
431
432
433
435 {
437 endptr = num + 3;
438 }
440 {
442 endptr = num + 8;
443 }
445 {
447 endptr = num + 9;
448 }
450 {
452 endptr = num + 9;
453 }
455 {
457 endptr = num + 3;
458 }
460 {
462 endptr = num + 4;
463 }
465 {
467 endptr = num + 4;
468 }
470 {
471
472
473
474
475
476
477
478
479
480
481
483 {
485
489 errmsg("\"%s\" is out of range for type double precision",
491 }
492 }
493 else
496 errmsg("invalid input syntax for type %s: \"%s\"",
498 }
499
500
501 while (*endptr != '\0' && isspace((unsigned char) *endptr))
502 endptr++;
503
504
507 else if (*endptr != '\0')
510 errmsg("invalid input syntax for type %s: \"%s\"",
512
513 return val;
514}
References ereturn, errcode(), errmsg, fb(), get_float8_infinity(), get_float8_nan(), pg_strncasecmp(), pstrdup(), and val.
Referenced by dependencies_scalar(), executeItemOptUnwrapTarget(), float8in(), and single_decode().
◆ float8larger()
◆ float8le()
◆ float8lt()
◆ float8mi()
◆ float8mul()
◆ float8ne()
◆ float8out()
◆ float8out_internal()
Definition at line 537 of file float.c.
538{
541
543 {
546 }
547
550}
int double_to_shortest_decimal_buf(double f, char *result)
References ascii(), double_to_shortest_decimal_buf(), extra_float_digits, fb(), palloc(), and pg_strfromd().
Referenced by cube_out(), float8out(), line_out(), pair_encode(), and single_encode().
◆ float8pl()
◆ float8recv()
◆ float8send()
◆ float8smaller()
◆ float8um()
◆ float8up()
◆ float_overflow_error()
Definition at line 86 of file float.c.
87{
90 errmsg("value out of range: overflow")));
91}
References ereport, errcode(), errmsg, ERROR, and fb().
Referenced by dacos(), dacosd(), dasin(), dasind(), datan(), datan2(), datan2d(), datand(), dcbrt(), dcos(), dcosd(), derf(), derfc(), dexp(), dgamma(), dlgamma(), dlog1(), dlog10(), dpow(), dsin(), dsind(), dsqrt(), dtanh(), dtof(), float4_accum(), float4_dist(), float4_div(), float4_mi(), float4_mul(), float4_pl(), float8_accum(), float8_combine(), float8_dist(), float8_div(), float8_mi(), float8_mul(), float8_pl(), float8_regr_accum(), float8_regr_combine(), and gbt_float8_dist().
◆ float_underflow_error()
Definition at line 94 of file float.c.
95{
98 errmsg("value out of range: underflow")));
99}
References ereport, errcode(), errmsg, ERROR, and fb().
Referenced by dcbrt(), dcosh(), dexp(), dgamma(), dlog1(), dlog10(), dpow(), dsqrt(), dtof(), float4_div(), float4_mul(), float8_div(), and float8_mul().
◆ float_zero_divide_error()
◆ ftod()
◆ ftoi2()
◆ ftoi4()
◆ i2tod()
◆ i2tof()
◆ i4tod()
◆ i4tof()
◆ in_range_float4_float8()
Definition at line 1103 of file float.c.
1104{
1111
1112
1113
1114
1115
1116 if (isnan(offset) || offset < 0)
1119 errmsg("invalid preceding or following size in window function")));
1120
1121
1122
1123
1124
1125
1127 {
1128 if (isnan(base))
1130 else
1132 }
1133 else if (isnan(base))
1134 {
1136 }
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1152 (sub ? base > 0 : base < 0))
1154
1155
1156
1157
1158
1159
1160
1161 if (sub)
1162 sum = base - offset;
1163 else
1164 sum = base + offset;
1165
1168 else
1170}
#define PG_GETARG_BOOL(n)
References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_BOOL, PG_GETARG_FLOAT4, PG_GETARG_FLOAT8, PG_RETURN_BOOL, and val.
◆ in_range_float8_float8()
Definition at line 1027 of file float.c.
1028{
1035
1036
1037
1038
1039
1040 if (isnan(offset) || offset < 0)
1043 errmsg("invalid preceding or following size in window function")));
1044
1045
1046
1047
1048
1049
1051 {
1052 if (isnan(base))
1054 else
1056 }
1057 else if (isnan(base))
1058 {
1060 }
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1076 (sub ? base > 0 : base < 0))
1078
1079
1080
1081
1082
1083
1084
1085 if (sub)
1086 sum = base - offset;
1087 else
1088 sum = base + offset;
1089
1092 else
1094}
References ereport, errcode(), errmsg, ERROR, fb(), PG_GETARG_BOOL, PG_GETARG_FLOAT8, PG_RETURN_BOOL, and val.
◆ init_degree_constants()
Definition at line 2019 of file float.c.
2020{
2029}
float8 degree_c_forty_five
References acos_0_5, asin_0_5, atan_1_0, cosd_q1(), cot_45, degree_c_forty_five, degree_c_one, degree_c_one_half, degree_c_sixty, degree_c_thirty, degree_consts_set, fb(), one_minus_cos_60, RADIANS_PER_DEGREE, sin_30, sind_q1(), and tan_45.
◆ is_infinite()
Definition at line 118 of file float.c.
119{
121
122 if (inf == 0)
123 return 0;
124 else if (val > 0)
125 return 1;
126 else
127 return -1;
128}
◆ radians()
◆ sind_0_to_30()
◆ sind_q1()
◆ width_bucket_float8()
Definition at line 4188 of file float.c.
4189{
4195
4196 if (count <= 0)
4199 errmsg("count must be greater than zero")));
4200
4204 errmsg("lower and upper bounds cannot be NaN")));
4205
4209 errmsg("lower and upper bounds must be finite")));
4210
4212 {
4213 if (isnan(operand) || operand >= bound2)
4214 {
4218 errmsg("integer out of range")));
4219 }
4220 else if (operand < bound1)
4221 result = 0;
4222 else
4223 {
4225 {
4226
4228 }
4229 else
4230 {
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240 result = count * ((operand / 2 - bound1 / 2) / (bound2 / 2 - bound1 / 2));
4241 }
4242
4243 if (result >= count)
4244 result = count - 1;
4245
4246 result++;
4247 }
4248 }
4250 {
4252 result = 0;
4253 else if (operand <= bound2)
4254 {
4258 errmsg("integer out of range")));
4259 }
4260 else
4261 {
4264 else
4265 result = count * ((bound1 / 2 - operand / 2) / (bound1 / 2 - bound2 / 2));
4266 if (result >= count)
4267 result = count - 1;
4268 result++;
4269 }
4270 }
4271 else
4272 {
4275 errmsg("lower bound cannot equal upper bound")));
4276 result = 0;
4277 }
4278
4280}
static bool pg_add_s32_overflow(int32 a, int32 b, int32 *result)
References ereport, errcode(), errmsg, ERROR, fb(), pg_add_s32_overflow(), PG_GETARG_FLOAT8, PG_GETARG_INT32, and PG_RETURN_INT32.
◆ acos_0_5
◆ asin_0_5
◆ atan_1_0
◆ cot_45
◆ degree_c_forty_five
float8 degree_c_forty_five = 45.0
◆ degree_c_one
◆ degree_c_one_half
float8 degree_c_one_half = 0.5
◆ degree_c_sixty
◆ degree_c_thirty
◆ degree_consts_set
◆ extra_float_digits
int extra_float_digits = 1