summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/numeric.c
AgeCommit message (Collapse)Author
2002-02-18Remove MAX/MIN() macros, use c.h Max/Min() instead.Bruce Momjian
2001-12-11Repair roundoff-error problem for stddev/variance results near zero,Tom Lane
per complaint from Kemin Zhou. Fix lack of precision in numeric stddev/variance.
2001-11-05New pgindent run with fixes suggested by Tom. Patch manually reviewed,Bruce Momjian
initdb/regression tests pass.
2001-10-28Another pgindent run. Fixes enum indenting, and improves #endifBruce Momjian
spacing. Also adds space for one-line comments.
2001-10-25pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian
tests pass.
2001-10-13Make selectivity routines cope gracefully with NaNs, infinities, andTom Lane
NUMERIC values that are out of the range of 'double'. Per trouble report from Mike Quinn.
2001-10-03Implement precision support for timestamp and time, both with and withoutThomas G. Lockhart
time zones. SQL99 spec requires a default of zero (round to seconds) which is set in gram.y as typmod is set in the parse tree. We *could* change to a default of either 6 (for internal compatibility with previous versions) or 2 (for external compatibility with previous versions). Evaluate entries in pg_proc wrt the iscachable attribute for timestamp and other date/time types. Try to recognize cases where side effects like the current time zone setting may have an effect on results to decide whether something is cachable or not.
2001-08-14sum() on int2 and int4 columns now uses an int8, not numeric, accumulatorTom Lane
for speed reasons; its result type also changes to int8. avg() on these datatypes now accumulates the running sum in int8 for speed; but we still deliver the final result as numeric, so that fractional accuracy is preserved. count() now counts and returns in int8, not int4. I am a little nervous about this possibly breaking users' code, but there didn't seem to be a strong sentiment for avoiding the problem. If we get complaints during beta, we can change count back to int4 and add a "count8" aggregate. For that matter, users can do it for themselves with a simple CREATE AGGREGATE command; the int4inc function is still present, so no C hacking is needed. Also added max() and min() aggregates for OID that do proper unsigned comparison, instead of piggybacking on int4 aggregates. initdb forced.
2001-06-07This adds unary plus capability. No grammar changes, per Tom's request.Bruce Momjian
Marko Kreen
2001-05-03Ensure that btree sort ordering functions and boolean comparison operatorsTom Lane
give consistent results for all datatypes. Types float4, float8, and numeric were broken for NaN values; abstime, timestamp, and interval were broken for INVALID values; timetz was just plain broken (some possible pairs of values were neither < nor = nor >). Also clean up text, bpchar, varchar, and bit/varbit to eliminate duplicate code and thereby reduce the probability of similar inconsistencies arising in the future.
2001-04-14Another try at making numeric MODULO operator produce the right answer.Tom Lane
Although it was now using the right equation, it was making bogus choices of the precision to compute intermediate results to. I'm not sure this is really right even yet, but it's better than before ...
2001-03-22Remove dashes in comments that don't need them, rewrap with pgindent.Bruce Momjian
2001-03-22pgindent run. Make it all clean.Bruce Momjian
2001-03-14Fix numeric modulo operator for case of fractional right argument.Tom Lane
2000-12-07Silence compiler warning.Tom Lane
2000-12-03Ensure that all uses of <ctype.h> functions are applied to unsigned-charTom Lane
values, whether the local char type is signed or not. This is necessary for portability. Per discussion on pghackers around 9/16/00.
2000-08-01Convert all remaining float4 and float8 functions to new fmgr style.Tom Lane
At this point I think it'd be possible to make float4 be pass-by-value without too much work --- and float8 too on machines where Datum is 8 bytes. Something to try when the mood strikes, anyway.
2000-07-29bpchar, varchar, bytea, numeric are toastable --- if you initdb, whichTom Lane
I did not force. I marked numeric as compressable-but-not-move-off-able, partly to test that storage mode and partly because I've got doubts that numerics are large enough to need external storage.
2000-07-17Revise aggregate functions per earlier discussions in pghackers.Tom Lane
There's now only one transition value and transition function. NULL handling in aggregates is a lot cleaner. Also, use Numeric accumulators instead of integer accumulators for sum/avg on integer datatypes --- this avoids overflow at the cost of being a little slower. Implement VARIANCE() and STDDEV() aggregates in the standard backend. Also, enable new LIKE selectivity estimators by default. Unrelated change, but as long as I had to force initdb anyway...
2000-06-15Clean up #include's.Bruce Momjian
2000-06-14Big warnings cleanup for Solaris/GCC. Down to about 40 now, butPeter Eisentraut
we'll get there one day. Use `cat' to create aclocal.m4, not `aclocal'. Some people don't have automake installed. Only run the autoconf rule in the top-level GNUmakefile if the invoker specified `make configure', don't run it automatically because of CVS timestamp skew.
2000-06-13Another batch of fmgr updates. I think I have gotten all old-styleTom Lane
functions that take pass-by-value datatypes. Should be ready for port testing ...
2000-06-05Latest round of fmgr updates. All functions with bool,char, or int2Tom Lane
inputs have been converted to newstyle. This should go a long way towards fixing our portability problems with platforms where char and short parameters are passed differently from int-width parameters. Still more to do for the Alpha port however.
2000-04-12Ye-old pgindent run. Same 4-space tabs.Bruce Momjian
2000-03-13Extend numeric_round and numeric_trunc to accept negative scale inputsTom Lane
(ie, allow rounding to occur at a digit position left of the decimal point). Apparently this is how Oracle handles it, and there are precedents in other programming languages as well.
2000-02-24Add numeric <-> int8 and numeric <-> int2 conversion functions, as wellTom Lane
as a unary minus operator for numeric. Now that long numeric constants will get converted to NUMERIC in early parsing, it's essential to have numeric->int8 conversion to avoid 'can't convert' errors on undecorated int8 constants. Threw in the rest for completeness while I was in the area. I did not force an initdb for this, since the system will still run without the new pg_proc/pg_operator entries. Possibly I should've.
2000-01-20Fix bugs in NUMERIC ceil() and floor() functions. ceil(0) returned 1,Tom Lane
and both would insert random junk digits if given an input that was an exact multiple of 10.
2000-01-18numeric_in accepts exponents; numeric to int4 rounds; float4/8 to numericTom Lane
is considerably more robust and accurate than it used to be. Also, get rid of numeric's private allocation freelist, which is no longer a win since Jan rewrote palloc.
2000-01-15Clean up problems with rounding/overflow code in NUMERIC, particularlyTom Lane
the case wherein zero was rejected for a field like NUMERIC(4,4). Miscellaneous other code beautification efforts.
2000-01-05Fix it's and its to be correct.Bruce Momjian
1999-09-29Added nbtree operator class for NUMERICJan Wieck
Jan
1999-07-17 Move some system includes into c.h, and remove duplicates.Bruce Momjian
1999-07-15Clean up #include in /include directory. Add scripts for checking includes.Bruce Momjian
1999-07-14Cleanup of /include #include's, for 6.6 only.Bruce Momjian
1999-05-25Another pgindent run. Sorry folks.Bruce Momjian
1999-05-25Make 0x007f -> (unsigned)0x7f to make pgindent happy.Bruce Momjian
1999-05-25pgindent run over code.Bruce Momjian
1999-05-10Check for NUMERIC overflow a second time after roundingJan Wieck
Jan
1999-05-04Use sprintf() to convert float8 to a string during conversion to numeric.Thomas G. Lockhart
Original code used float8out(), but the resulting exponential notation was not handled (e.g. '3E9' was decoded as '3').
1999-03-14src/backend/utils/adt/numeric.c fails to compile due to a string havingBruce Momjian
an embedded new-line character. Billy G. Allie
1999-02-13Change my-function-name-- to my_function_name, and optimizer renames.Bruce Momjian
1999-01-05Removed precision restriction in numeric_round() causingJan Wieck
overflow error on high precision calculations where temporary huge precision is required. Jan
1999-01-04Just one more bugfix - this time in cmp_abs (cannot imagine thatJan Wieck
taking a logarithm with a 400 digit precision worked with that bug in place). Jan
1999-01-04Fixed backend crashing bug in apply_typmod()Jan Wieck
Jan
1999-01-04Little fix for round() functionJan Wieck
Jan
1999-01-03Fix NAN code.Bruce Momjian
1999-01-03Fix for NAN generation.Bruce Momjian
1999-01-01Fix for no platform NAN.Bruce Momjian
1998-12-30Little precision fix for POWER(). I discovered problems with bigJan Wieck
exponents. Jan
1998-12-30Added NUMERIC data type with many builtin funcitons, operatorsJan Wieck
and aggregates. Jan