#include "fmgr.h"
Go to the source code of this file.
Defines | |
#define | NUMERIC_MAX_PRECISION 1000 |
#define | NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION |
#define | NUMERIC_MIN_DISPLAY_SCALE 0 |
#define | NUMERIC_MAX_RESULT_SCALE (NUMERIC_MAX_PRECISION * 2) |
#define | NUMERIC_MIN_SIG_DIGITS 16 |
#define | DatumGetNumeric(X) ((Numeric) PG_DETOAST_DATUM(X)) |
#define | DatumGetNumericCopy(X) ((Numeric) PG_DETOAST_DATUM_COPY(X)) |
#define | NumericGetDatum(X) PointerGetDatum(X) |
#define | PG_GETARG_NUMERIC(n) DatumGetNumeric(PG_GETARG_DATUM(n)) |
#define | PG_GETARG_NUMERIC_COPY(n) DatumGetNumericCopy(PG_GETARG_DATUM(n)) |
#define | PG_RETURN_NUMERIC(x) return NumericGetDatum(x) |
Typedefs | |
typedef struct NumericData * | Numeric |
Functions | |
bool | numeric_is_nan (Numeric num) |
int32 | numeric_maximum_size (int32 typmod) |
char * | numeric_out_sci (Numeric num, int scale) |
#define DatumGetNumeric | ( | X | ) | ((Numeric) PG_DETOAST_DATUM(X)) |
Definition at line 48 of file numeric.h.
Referenced by cash_numeric(), gbt_numeric_consistent(), gbt_numeric_penalty(), int2_accum(), int4_accum(), int64_to_numeric(), int8_accum(), int8_avg_accum(), int8_to_char(), numeric_avg(), numeric_plus_one_over_two(), numeric_shift_right(), numeric_stddev_internal(), numeric_to_char(), and pg_xlog_location_diff().
#define DatumGetNumericCopy | ( | X | ) | ((Numeric) PG_DETOAST_DATUM_COPY(X)) |
#define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION |
Definition at line 28 of file numeric.h.
Referenced by log_var(), numeric_exp(), numeric_ln(), numeric_sqrt(), power_var(), and select_div_scale().
#define NUMERIC_MAX_PRECISION 1000 |
Definition at line 23 of file numeric.h.
Referenced by numeric_recv(), numerictypmodin(), and set_var_from_str().
#define NUMERIC_MAX_RESULT_SCALE (NUMERIC_MAX_PRECISION * 2) |
Definition at line 31 of file numeric.h.
Referenced by exp_var(), numeric_exp(), numeric_recv(), numeric_round(), numeric_trunc(), and power_var().
#define NUMERIC_MIN_DISPLAY_SCALE 0 |
Definition at line 29 of file numeric.h.
Referenced by log_var(), numeric_exp(), numeric_ln(), numeric_sqrt(), power_var(), and select_div_scale().
#define NUMERIC_MIN_SIG_DIGITS 16 |
Definition at line 38 of file numeric.h.
Referenced by log_var(), numeric_exp(), numeric_ln(), numeric_sqrt(), power_var(), and select_div_scale().
#define NumericGetDatum | ( | X | ) | PointerGetDatum(X) |
Definition at line 50 of file numeric.h.
Referenced by do_numeric_accum(), do_numeric_avg_accum(), gbt_numeric_penalty(), gin_numeric_cmp(), int8_sum(), numeric_avg(), numeric_float4(), numeric_float8(), numeric_is_less(), numeric_plus_one_over_two(), numeric_shift_right(), numeric_to_char(), numeric_to_cstring(), and numeric_to_double_no_overflow().
#define PG_GETARG_NUMERIC | ( | n | ) | DatumGetNumeric(PG_GETARG_DATUM(n)) |
Definition at line 51 of file numeric.h.
Referenced by hash_numeric(), int8_sum(), numeric(), numeric_abs(), numeric_accum(), numeric_add(), numeric_avg_accum(), numeric_ceil(), numeric_cmp(), numeric_div(), numeric_div_trunc(), numeric_eq(), numeric_exp(), numeric_float4(), numeric_float8(), numeric_float8_no_overflow(), numeric_floor(), numeric_ge(), numeric_gt(), numeric_inc(), numeric_int2(), numeric_int4(), numeric_int8(), numeric_larger(), numeric_le(), numeric_ln(), numeric_log(), numeric_lt(), numeric_mod(), numeric_mul(), numeric_ne(), numeric_out(), numeric_power(), numeric_round(), numeric_send(), numeric_sign(), numeric_smaller(), numeric_sqrt(), numeric_sub(), numeric_to_char(), numeric_trunc(), numeric_uminus(), numeric_uplus(), pg_size_pretty_numeric(), and width_bucket_numeric().
#define PG_GETARG_NUMERIC_COPY | ( | n | ) | DatumGetNumericCopy(PG_GETARG_DATUM(n)) |
#define PG_RETURN_NUMERIC | ( | x | ) | return NumericGetDatum(x) |
Definition at line 53 of file numeric.h.
Referenced by cash_numeric(), float4_numeric(), float8_numeric(), int2_numeric(), int4_numeric(), int8_numeric(), int8_sum(), numeric(), numeric_abs(), numeric_add(), numeric_ceil(), numeric_div(), numeric_div_trunc(), numeric_exp(), numeric_fac(), numeric_floor(), numeric_in(), numeric_inc(), numeric_larger(), numeric_ln(), numeric_log(), numeric_mod(), numeric_mul(), numeric_power(), numeric_recv(), numeric_round(), numeric_sign(), numeric_smaller(), numeric_sqrt(), numeric_stddev_pop(), numeric_stddev_samp(), numeric_sub(), numeric_trunc(), numeric_uminus(), numeric_uplus(), numeric_var_pop(), numeric_var_samp(), and pg_xlog_location_diff().
typedef struct NumericData* Numeric |
Definition at line 561 of file numeric.c.
References NUMERIC_IS_NAN.
Referenced by gbt_numeric_penalty().
{ return NUMERIC_IS_NAN(num); }
Definition at line 572 of file numeric.c.
References DEC_DIGITS, NUMERIC_HDRSZ, and VARHDRSZ.
Referenced by type_maximum_size().
{ int precision; int numeric_digits; if (typmod < (int32) (VARHDRSZ)) return -1; /* precision (ie, max # of digits) is in upper bits of typmod */ precision = ((typmod - VARHDRSZ) >> 16) & 0xffff; /* * This formula computes the maximum number of NumericDigits we could need * in order to store the specified number of decimal digits. Because the * weight is stored as a number of NumericDigits rather than a number of * decimal digits, it's possible that the first NumericDigit will contain * only a single decimal digit. Thus, the first two decimal digits can * require two NumericDigits to store, but it isn't until we reach * DEC_DIGITS + 2 decimal digits that we potentially need a third * NumericDigit. */ numeric_digits = (precision + 2 * (DEC_DIGITS - 1)) / DEC_DIGITS; /* * In most cases, the size of a numeric will be smaller than the value * computed below, because the varlena header will typically get toasted * down to a single byte before being stored on disk, and it may also be * possible to use a short numeric header. But our job here is to compute * the worst case. */ return NUMERIC_HDRSZ + (numeric_digits * sizeof(NumericDigit)); }
char* numeric_out_sci | ( | Numeric | num, | |
int | scale | |||
) |
Definition at line 611 of file numeric.c.
References get_str_from_var_sci(), init_var_from_num(), NUMERIC_IS_NAN, and pstrdup().
Referenced by int8_to_char(), and numeric_to_char().
{ NumericVar x; char *str; /* * Handle NaN */ if (NUMERIC_IS_NAN(num)) return pstrdup("NaN"); init_var_from_num(num, &x); str = get_str_from_var_sci(&x, scale); return str; }