summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/float.c
AgeCommit message (Collapse)Author
2005-04-06Apply the "nodeAgg" optimization to more of the builtin transitionNeil Conway
functions. This patch optimizes int2_sum(), int4_sum(), float4_accum() and float8_accum() to avoid needing to copy the transition function's state for each input tuple of the aggregate. In an extreme case (e.g. SELECT sum(int2_col) FROM table where table has a single column), it improves performance by about 20%. For more complex queries or tables with wider rows, the relative performance improvement will not be as significant.
2005-02-11Adjust input routines for float4, float8 and oid to reject the empty stringNeil Conway
as valid input (it was previously treated as 0). This input was deprecated in 8.0 (and a warning was emitted). Regression tests updated.
2004-12-31Tag appropriate files for rc3PostgreSQL Daemon
Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
2004-10-04Detect overflow in integer arithmetic operators (integer, smallint, andTom Lane
bigint variants). Clean up some inconsistencies in error message wording. Fix scanint8 to allow trailing whitespace in INT64_MIN case. Update int8-exp-three-digits.out, which seems to have been ignored by the last couple of people to modify the int8 regression test, and remove int8-exp-three-digits-win32.out which is thereby exposed as redundant.
2004-09-02Cope with recent HPUX versions providing isfinite() instead of finite().Tom Lane
2004-08-29Pgindent run for 8.0.Bruce Momjian
2004-08-29Update copyright to 2004.Bruce Momjian
2004-08-11Work around broken strtod() that's present in many Solaris releases.Tom Lane
Thanks to Michael Fuhr for identifying the problem.
2004-08-04Label CVS tip as 8.0devel instead of 7.5devel. Adjust various commentsTom Lane
and documentation to reference 8.0 instead of 7.5.
2004-05-16Change ln(), log(), power(), and sqrt() to emit the correct SQLSTATENeil Conway
error codes for certain error conditions, as specified by SQL2003.
2004-05-07Solve the 'Turkish problem' with undesirable locale behavior for caseTom Lane
conversion of basic ASCII letters. Remove all uses of strcasecmp and strncasecmp in favor of new functions pg_strcasecmp and pg_strncasecmp; remove most but not all direct uses of toupper and tolower in favor of pg_toupper and pg_tolower. These functions use the same notions of case folding already developed for identifier case conversion. I left the straight locale-based folding in place for situations where we are just manipulating user data and not trying to match it to built-in strings --- for example, the SQL upper() function is still locale dependent. Perhaps this will prove not to be what's wanted, but at the moment we can initdb and pass regression tests in Turkish locale.
2004-04-01Fix some portability issues with new float input code (didn't work onTom Lane
HPUX 11 ...)
2004-04-01Add missing casts to unsigned char in recently-added isspace() calls.Tom Lane
2004-03-15Localize our dependencies on the way to create NAN or INFINITY.Tom Lane
Per recent proposal to pghackers.
2004-03-14Portability fixes and bug fixes for recent floating point input changes.Neil Conway
In particular, don't depend on strtod() to accept 'NaN' and 'Infinity' inputs (while this is required by C99, not all platforms are compliant with that yet). Also, don't require glibc's behavior from isinf(): it seems that on a lot of platforms isinf() does not itself distinguish between negative and positive infinity.
2004-03-12Allow 'Infinity' and '-Infinity' as input to the float4 and float8Neil Conway
types. Update the regression tests and the documentation to reflect this. Remove the UNSAFE_FLOATS #ifdef. This is only half the story: we still unconditionally reject floating point operations that result in +/- infinity. See recent thread on -hackers for more information.
2004-03-11Revise int2/int4/int8/float4/float8 input routines to allow forNeil Conway
any amount of leading or trailing whitespace (where "whitespace" is defined by isspace()). This is for SQL conformance, as well as consistency with other numeric types (e.g. oid, numeric). Also refactor pg_atoi() to avoid looking at errno where not necessary, and add a bunch of regression tests for the input to these types.
2004-03-04Emit a warning when an empty string is input to the oid, float4, andNeil Conway
float8 types. This begins the deprecation of this feature: in 7.6, this input will be rejected. Also added a new error code for warnings about deprecated features, and updated the regression tests.
2003-11-29$Header: -> $PostgreSQL Changes ...PostgreSQL Daemon
2003-11-12Cross-data-type comparisons are now indexable by btrees, pursuant to myTom Lane
pghackers proposal of 8-Nov. All the existing cross-type comparison operators (int2/int4/int8 and float4/float8) have appropriate support. The original proposal of storing the right-hand-side datatype as part of the primary key for pg_amop and pg_amproc got modified a bit in the event; it is easier to store zero as the 'default' case and only store a nonzero when the operator is actually cross-type. Along the way, remove the long-since-defunct bigbox_ops operator class.
2003-09-25Message editing: remove gratuitous variations in message wording, standardizePeter Eisentraut
terms, add some clarifications, fix some untranslatable attempts at dynamic message building.
2003-08-04Update copyrights to 2003.Bruce Momjian
2003-08-04pgindent run.Bruce Momjian
2003-07-30Fix numeric_smaller, numeric_larger, float4smaller, float4larger,Tom Lane
float8smaller, float8larger (and thereby the MIN/MAX aggregates on these datatypes) to agree with the datatypes' comparison operations as regards NaN handling. In all these datatypes, NaN is arbitrarily considered larger than any normal value ... but MIN/MAX had not gotten the word. Per recent discussion on pgsql-sql.
2003-07-27Error message editing in utils/adt. Again thanks to Joe Conway for doingTom Lane
the bulk of the heavy lifting ...
2003-05-26Remove comment that cbrt() isn't being used.Bruce Momjian
2003-05-25Clean up our static cbrt() implementation in float.c.Bruce Momjian
2003-05-09COPY BINARY uses the new binary I/O routines. Update a few more datatypesTom Lane
so that COPY BINARY regression test passes.
2003-05-09Remove another old rint() replacement.Bruce Momjian
2003-04-21stddev() and variance() should return NULL when there is just one inputTom Lane
value, per recent discussion on pgsql-general.
2003-03-11Add explicit tests for division by zero to all user-accessible integerTom Lane
division and modulo functions, to avoid problems on OS X (which fails to trap 0 divide at all) and Windows (which traps it in some bizarre nonstandard fashion). Standardize on 'division by zero' as the one true spelling of this error message. Add regression tests as suggested by Neil Conway.
2002-11-08Add extra_float_digits GUC parameter to allow adjustment of displayedTom Lane
precision for float4, float8, and geometric types. Set it in pg_dump so that float data can be dumped/reloaded exactly (at least on platforms where the float I/O support is properly implemented). Initial patch by Pedro Ferreira, some additional work by Tom Lane.
2002-10-19This patch adds some missing functions for float8 math operations,Bruce Momjian
specifically ceil(), floor(), and sign(). There may be other functions that need to be added, but this is a start. I've included some simple regression tests. Neil Conway
2002-09-04pgindent run.Bruce Momjian
2002-08-26Modify array operations to include array's element type OID in theTom Lane
array header, and to compute sizing and alignment of array elements the same way normal tuple access operations do --- viz, using the tupmacs.h macros att_addlength and att_align. This makes the world safe for arrays of cstrings or intervals, and should make it much easier to write array-type-polymorphic functions; as examples see the cleanups of array_out and contrib/array_iterator. By Joe Conway and Tom Lane.
2002-06-20Update copyright to 2002.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-06-07This adds unary plus capability. No grammar changes, per Tom's request.Bruce Momjian
Marko Kreen
2001-06-02Accept and output '-Infinity' as well as 'Infinity', per long-agoTom Lane
suggestion from Ross Reedstrom. Still needs work to make those symbols convert to actual IEEE infinities (on machines where such things exist).
2001-06-02Paranoia about unordered comparisons in IEEE float math. If we areTom Lane
given values that compare as unordered, make sure we reply that they are equal, which is better than giving an arbitrary answer --- at least it doesn't depend on which one is passed as which arg.
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-03-22pgindent run. Make it all clean.Bruce Momjian
2001-01-24Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian
2000-08-07Clean up bogosities in use of random(3) and srandom(3) --- do not assumeTom Lane
that RAND_MAX applies to them, since it doesn't. Instead add a config.h parameter MAX_RANDOM_VALUE. This is currently set at 2^31-1 but could be auto-configured if that ever proves necessary. Also fix some outright bugs like calling srand() where srandom() is appropriate.
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-28Remove <values.h> inclusions, no-longer-needed MAXINT definitions.Tom Lane
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...