Received: from maia.hub.org (maia-4.hub.org [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id E5042632994 for ; Fri, 21 May 2010 00:34:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 83697-02 for ; Fri, 21 May 2010 03:34:11 +0000 (UTC) Received: from pgfoundry.org (pgfoundry.org [200.46.204.130]) by mail.postgresql.org (Postfix) with ESMTP id BDC8C632230 for ; Fri, 21 May 2010 00:34:11 -0300 (ADT) Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by pgfoundry.org (Postfix) with ESMTP id A16F8107164C for ; Fri, 21 May 2010 03:34:11 +0000 (UTC) Received: from pgfoundry.org ([200.46.204.130]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 16277-01; Fri, 21 May 2010 03:34:04 +0000 (UTC) Received: by pgfoundry.org (Postfix, from userid 80) id 692F0107164B; Fri, 21 May 2010 03:34:04 +0000 (UTC) To: noreply@pgfoundry.org From: Subject: [ psqlodbc-Bugs-1010515 ] Small negative decimal values are mistaken for non-negative Content-type: text/plain; charset=UTF-8 Message-Id: <20100521033404.692F0107164B@pgfoundry.org> Date: Fri, 21 May 2010 03:34:04 +0000 (UTC) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.011 tagged_above=-10 required=5 tests=BAYES_20=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/37 X-Sequence-Number: 10284 Bugs item #1010515, was opened at 2008-11-28 11:32 You can respond by visiting: http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1010515&group_id=1000125 Category: None Group: None >Status: Closed Resolution: None Priority: 3 Submitted By: Dominic Smith (dominic_smith) Assigned to: Hiroshi Inoue (hinoue) Summary: Small negative decimal values are mistaken for non-negative Initial Comment: I originally found this problem in an older snapshot of 8.02.0400, however it seems to still exist in the current CVS copy. In the method ResolveNumericParam (convert.c), there is a problem where resolving decimal values between 0 and -1, as they will be mistaken for being positive. e.g. -0.01 becomes 0.01. The problem is based on lines 3259:3262. The code in question: o1val = ival / div; o2val = ival % div; if(0 == ns->sign) olval *= -1; The problem here is, in the case of -0.01, o1val is 0, and so 0 * -1 is still zero. When you come to format this as sprintf(chrform, "%d.%0*d", o1val, ns->scale, o2val); we quite obviously lose the negative sign in the value. A very small aside, and a rather selfish request perhaps, the method 'trim()' in misc.c - is there any possibility of renaming this method (or at least make it static to 'connection.c' which is the only module that calls this) - the name is very common, and causes problems when the driver is dl_open()'d. ---------------------------------------------------------------------- Comment By: Hiroshi Inoue (hinoue) Date: 2009-01-04 02:58 Message: Hi Dominic, I've just committed the changes for both. regards, Hiroshi Inoue ---------------------------------------------------------------------- Comment By: Hiroshi Inoue (hinoue) Date: 2008-12-04 00:04 Message: Hi Dominic, I would take care of both in the next release. Thanks. Hiroshi Inoue ---------------------------------------------------------------------- You can respond by visiting: http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1010515&group_id=1000125