summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/float.c
AgeCommit message (Collapse)Author
2013-01-01Update copyrights for 2013Bruce Momjian
Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
2012-06-10Run pgindent on 9.2 source tree in preparation for first 9.3Bruce Momjian
commit-fest.
2012-02-24Add some enumeration commas, for consistencyPeter Eisentraut
2012-02-01Try to be more consistent about accepting denormalized float8 numbers.Tom Lane
On some platforms, strtod() reports ERANGE for a denormalized value (ie, one that can be represented as distinct from zero, but is too small to have full precision). On others, it doesn't. It seems better to try to accept these values consistently, so add a test to see if the result value indicates a true out-of-range condition. This should be okay per Single Unix Spec. On machines where the underlying math isn't IEEE standard, the behavior for such small numbers may not be very consistent, but then it wouldn't be anyway. Marti Raudsepp, after a proposal by Jeroen Vermeulen
2012-01-01Update copyright notices for year 2012.Bruce Momjian
2011-12-07Create a "sort support" interface API for faster sorting.Tom Lane
This patch creates an API whereby a btree index opclass can optionally provide non-SQL-callable support functions for sorting. In the initial patch, we only use this to provide a directly-callable comparator function, which can be invoked with a bit less overhead than the traditional SQL-callable comparator. While that should be of value in itself, the real reason for doing this is to provide a datatype-extensible framework for more aggressive optimizations, as in Peter Geoghegan's recent work. Robert Haas and Tom Lane
2011-01-01Stamp copyrights for year 2011.Bruce Momjian
2010-09-20Remove cvs keywords from all files.Magnus Hagander
2010-02-27Insert a hack into get_float8_nan (both core and ecpg copies) to deal withTom Lane
the fact that NetBSD/mips is currently broken, as per buildfarm member pika. Also add regression tests to ensure that get_float8_nan and get_float4_nan are exercised even on platforms where they are not needed by float8in/float4in. Zoltán Böszörményi and Tom Lane
2010-02-08Create an official API function for C functions to use to check if they areTom Lane
being called as aggregates, and to get the aggregate transition state memory context if needed. Use it instead of poking directly into AggState and WindowAggState in places that shouldn't know so much. We should have done this in 8.4, probably, but better late than never. Revised version of a patch by Hitoshi Harada.
2010-01-02Update copyright for the year 2010.Bruce Momjian
2009-09-11Increase the maximum value of extra_float_digits to 3, and have pg_dumpTom Lane
use that value when the backend is new enough to allow it. This responds to bug report from Keh-Cheng Chu pointing out that although 2 extra digits should be sufficient to dump and restore float8 exactly, it is possible to need 3 extra digits for float4 values.
2009-06-118.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian
provided by Andrew.
2009-03-04Put back our old workaround for machines that declare cbrt() in math.h butTom Lane
fail to provide the function itself. Not sure how we escaped testing anything later than 7.3 on such cases, but they still exist, as per André Volpato's report about AIX 5.3.
2009-02-18Remove the special cases to prevent minus-zero results in float4 and float8Tom Lane
unary minus operators. We weren't attempting to prevent minus zero anywhere else; in view of our gradual trend to make the float datatypes more IEEE standard compliant, we should allow minus zero here rather than disallow it elsewhere. We don't, however, expect that all platforms will produce minus zero, so we need to adjust the one affected regression test to allow both results. Per discussion of bug #4660. (In passing, clean up a couple other minor infelicities in float.c.)
2009-01-01Update copyright for 2009.Bruce Momjian
2008-12-28Support window functions a la SQL:2008.Tom Lane
Hitoshi Harada, with some kibitzing from Heikki and Tom.
2008-05-09Adjust power() error messages to be more descriptive.Bruce Momjian
2008-05-09Update C comments to mention SQL:2003 handling of power return values.Bruce Momjian
2008-04-21Allow float8, int8, and related datatypes to be passed by value on machinesTom Lane
where Datum is 8 bytes wide. Since this will break old-style C functions (those still using version 0 calling convention) that have arguments or results of these types, provide a configure option to disable it and retain the old pass-by-reference behavior. Likewise, provide a configure option to disable the recently-committed float4 pass-by-value change. Zoltan Boszormenyi, plus configurability stuff by me.
2008-03-10Document and enforce that the usable range of setseed() arguments isTom Lane
-1 to 1, not 0 to 1. The actual behavior for values within this range does not change. Kris Jurka
2008-01-01Update copyrights in source tree to 2008.Bruce Momjian
2007-11-15pgindent run for 8.3.Bruce Momjian
2007-09-19Prevent corr() from returning the wrong results for negative correlationNeil Conway
values. The previous coding essentially assumed that x = sqrt(x*x), which does not hold for x < 0. Thanks to Jie Zhang at Greenplum and Gavin Sherry for reporting this issue.
2007-06-05Downgrade implicit casts to text to be assignment-only, except for the onesTom Lane
from the other string-category types; this eliminates a lot of surprising interpretations that the parser could formerly make when there was no directly applicable operator. Create a general mechanism that supports casts to and from the standard string types (text,varchar,bpchar) for *every* datatype, by invoking the datatype's I/O functions. These new casts are assignment-only in the to-string direction, explicit-only in the other, and therefore should create no surprising behavior. Remove a bunch of thereby-obsoleted datatype-specific casting functions. The "general mechanism" is a new expression node type CoerceViaIO that can actually convert between *any* two datatypes if their external text representations are compatible. This is more general than needed for the immediate feature, but might be useful in plpgsql or other places in future. This commit does nothing about the issue that applying the concatenation operator || to non-text types will now fail, often with strange error messages due to misinterpreting the operator as array concatenation. Since it often (not always) worked before, we should either make it succeed or at least give a more user-friendly error; but details are still under debate. Peter Eisentraut and Tom Lane
2007-02-27Replace direct assignments to VARATT_SIZEP(x) with SET_VARSIZE(x, len).Tom Lane
Get rid of VARATT_SIZE and VARATT_DATA, which were simply redundant with VARSIZE and VARDATA, and as a consequence almost no code was using the longer names. Rename the length fields of struct varlena and various derived structures to catch anyplace that was accessing them directly; and clean up various places so caught. In itself this patch doesn't change any behavior at all, but it is necessary infrastructure if we hope to play any games with the representation of varlena headers. Greg Stark and Tom Lane
2007-01-20Make setseed() return void, rather than an int4 without any use. PerNeil Conway
pgsql-patches discussion of September 20, 2006. Bump the catversion.
2007-01-16Implement width_bucket() for the float8 data type.Neil Conway
The implementation is somewhat ugly logic-wise, but I don't see an easy way to make it more concise. When writing this, I noticed that my previous implementation of width_bucket() doesn't handle NaN correctly: postgres=# select width_bucket('NaN', 1, 5, 5); width_bucket -------------- 6 (1 row) AFAICS SQL:2003 does not define a NaN value, so it doesn't address how width_bucket() should behave here. The patch changes width_bucket() so that ereport(ERROR) is raised if NaN is specified for the operand or the lower or upper bounds to width_bucket(). For float8, NaN is disallowed for any of the floating-point inputs, and +/- infinity is disallowed for the histogram bounds (but allowed for the operand). Update docs and regression tests, bump the catversion.
2007-01-06Apply fix so pow() and exp() ERANGE is used only if result is not 0.Bruce Momjian
2007-01-06Check for ERANGE in exp() as well.Bruce Momjian
Improve release docs for ecpg regression tests.
2007-01-06Improve dpow() check for ERANGE overflow for HPPA.Bruce Momjian
2007-01-06Put back ERANGE test in dpow(). There are platforms that need this,Tom Lane
like my HPPA ...
2007-01-05Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian
back-stamped for this.
2007-01-05Update float dpow() comment about whick platforms had issues with Nan.Bruce Momjian
Stefan Kaltenbrunner
2007-01-04Simplify assignment of Inf for pow Nan (don't worry about the sign).Bruce Momjian
2007-01-03Update pow() tests to check for both errno==EDOM _and_ result==Nan, andBruce Momjian
document why this happens. Remove exp() errno check because not needed.
2007-01-03Fix erroneous error tests in pow/exp.Tom Lane
2007-01-03Attempt to return proper overflow/underflow messages for platforms thatBruce Momjian
only return Nan and set errno for pow/exp overflow/underflow.
2007-01-03For float4/8, remove errno checks for pow() and exp() because only someBruce Momjian
platforms set errno, and we already have a check macro that detects under/overflow, so there is no reason for platform-specific code anymore.
2007-01-02Some platforms set errno on pow(), exp() overflow, some do not, so ifBruce Momjian
isinf(), fall through to our own infinity checks.
2007-01-02finite() no longer used; remove finite() platform-specificBruce Momjian
infrastructure.
2007-01-02Add #include <float.h> for platforms that still need it.Bruce Momjian
2007-01-02Fix float4/8 to handle Infinity and Nan consistently, e.g. Infinity is aBruce Momjian
valid result from a computation if one of the input values was infinity. The previous code assumed an operation that returned infinity was an overflow. Handle underflow/overflow consistently, and add checks for aggregate overflow. Consistently prevent Inf/Nan from being cast to integer data types. Fix INT_MIN % -1 to prevent overflow. Update regression results for new error text. Per report from Roman Kononov.
2006-12-23Remove unnecessary parentheses in if() statements.Bruce Momjian
2006-10-05Work around buggy strtod on (some versions of?) IRIX. Combination ofTom Lane
proposed patches from John Jorgensen and Steve Singer.
2006-10-04pgindent run for 8.2.Bruce Momjian
2006-07-28SQL2003-standard statistical aggregates, by Sergey Koposov. I've added onlyTom Lane
the float8 versions of the aggregates, which is all that the standard requires. Sergey's original patch also provided versions using numeric arithmetic, but given the size and slowness of the code, I doubt we ought to include those in core.
2006-07-14Remove 576 references of include files that were not needed.Bruce Momjian
2006-07-14Fix a passel of recently-committed violations of the rule 'thou shaltTom Lane
have no other gods before c.h'. Also remove some demonstrably redundant #include lines, mostly of <errno.h> which was added to c.h years ago.
2006-06-07Prepare code to be built by MSVC:Bruce Momjian
o remove many WIN32_CLIENT_ONLY defines o add WIN32_ONLY_COMPILER define o add 3rd argument to open() for portability o add include/port/win32_msvc directory for system includes Magnus Hagander