Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id EE8559F93A2 for ; Wed, 27 Dec 2006 17:05:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 00671-08 for ; Wed, 27 Dec 2006 17:05:36 -0400 (AST) X-Greylist: delayed 00:22:27.831743 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 7AFCC9FA434 for ; Wed, 27 Dec 2006 17:05:35 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by svr4.postgresql.org (Postfix) with ESMTP id E87665AF2CB for ; Wed, 27 Dec 2006 20:43:06 +0000 (GMT) Received: from out1.internal (unknown [10.202.2.149]) by out1.messagingengine.com (Postfix) with ESMTP id 64E8B59FFF; Wed, 27 Dec 2006 15:42:01 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by out1.internal (MEProxy); Wed, 27 Dec 2006 15:42:01 -0500 X-Sasl-enc: I3CM2pPJnDeqQfEkT57Rk6V1O2SbKV7Aw9+0oDYpB7GJ 1167252121 Received: from [10.10.0.130] (adsl-68-75-163-199.dsl.emhril.ameritech.net [68.75.163.199]) by mail.messagingengine.com (Postfix) with ESMTP id 0C062DC5A; Wed, 27 Dec 2006 15:42:00 -0500 (EST) Message-ID: <4592DAD8.1000400@xtremedatainc.com> Date: Wed, 27 Dec 2006 14:43:04 -0600 From: Roman Kononov User-Agent: Thunderbird 1.5.0.8 (X11/20061117) MIME-Version: 1.0 To: Bruce Momjian , PostgreSQL-patches Subject: Re: [BUGS] BUG #2846: inconsistent and confusing handling of underflows, References: <200612271844.kBRIiVb18465@momjian.us> In-Reply-To: <200612271844.kBRIiVb18465@momjian.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50 X-Spam-Level: X-Archive-Number: 200612/194 X-Sequence-Number: 21870 On 12/27/2006 12:44 PM, Bruce Momjian wrote: > The only unsolved issue is the one with underflow checks. I have added > comments explaining the problem in case someone ever figures out how to > address it. This will behave better for float4: Datum float4pl(PG_FUNCTION_ARGS) { --- float4 arg1 = PG_GETARG_FLOAT4(0); --- float4 arg2 = PG_GETARG_FLOAT4(1); +++ double arg1 = PG_GETARG_FLOAT4(0); +++ double arg2 = PG_GETARG_FLOAT4(1); double result; result = arg1 + arg2; CheckFloat4Val(result,isinf(arg1) || isinf(arg2)); PG_RETURN_FLOAT4((float4) result); } Roman