pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feed[ psqlodbc-Bugs-1010515 ] Small negative decimal values are mistaken for non-negative
2+ messages / 1 participants
[nested] [flat]
* [ psqlodbc-Bugs-1010515 ] Small negative decimal values are mistaken for non-negative
@ 2009-01-04 02:58 noreply@pgfoundry.org
0 siblings, 0 replies; 2+ messages in thread
From: noreply@pgfoundry.org @ 2009-01-04 02:58 UTC (permalink / raw)
To: noreply@pgfoundry.org
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: Open
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* [ psqlodbc-Bugs-1010515 ] Small negative decimal values are mistaken for non-negative
@ 2010-05-21 03:34 noreply@pgfoundry.org
0 siblings, 0 replies; 2+ messages in thread
From: noreply@pgfoundry.org @ 2010-05-21 03:34 UTC (permalink / raw)
To: noreply@pgfoundry.org
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2010-05-21 03:34 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-01-04 02:58 [ psqlodbc-Bugs-1010515 ] Small negative decimal values are mistaken for non-negative noreply@pgfoundry.org
2010-05-21 03:34 [ psqlodbc-Bugs-1010515 ] Small negative decimal values are mistaken for non-negative noreply@pgfoundry.org
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox