diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-07-22 19:19:44 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-07-22 19:19:44 -0400 |
commit | a57d312a7706321d850faa048a562a0c0c01b835 (patch) | |
tree | a70d8fb04fb1ab59b7cc76072e59dd2be02e1021 /src/include/utils/numeric.h | |
parent | 9e108984fb35d8f9e2c2bffa10c0034f9161e802 (diff) |
Support infinity and -infinity in the numeric data type.
Add infinities that behave the same as they do in the floating-point
data types. Aside from any intrinsic usefulness these may have,
this closes an important gap in our ability to convert floating
values to numeric and/or replace float-based APIs with numeric.
The new values are represented by bit patterns that were formerly
not used (although old code probably would take them for NaNs).
So there shouldn't be any pg_upgrade hazard.
Patch by me, reviewed by Dean Rasheed and Andrew Gierth
Discussion: https://postgr.es/m/606717.1591924582@sss.pgh.pa.us
Diffstat (limited to 'src/include/utils/numeric.h')
-rw-r--r-- | src/include/utils/numeric.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/utils/numeric.h b/src/include/utils/numeric.h index 0604cb65ed4..0b7d4ba3c4b 100644 --- a/src/include/utils/numeric.h +++ b/src/include/utils/numeric.h @@ -57,6 +57,7 @@ typedef struct NumericData *Numeric; * Utility functions in numeric.c */ extern bool numeric_is_nan(Numeric num); +extern bool numeric_is_inf(Numeric num); int32 numeric_maximum_size(int32 typmod); extern char *numeric_out_sci(Numeric num, int scale); extern char *numeric_normalize(Numeric num); |