[postgis-devel] [PostGIS] #703: measures test failure
PostGIS
trac at osgeo.org
Mon Dec 13 14:07:38 PST 2010
#703: measures test failure
---------------------+------------------------------------------------------
Reporter: strk | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.0.0
Component: postgis | Version: trunk
Keywords: |
---------------------+------------------------------------------------------
Comment(by nicklas):
Yes, nasty I confirm.
I tried with intermediate variable and it doesn't help. How come?
I don't understand it.
The row that makes difference between the systems is:
theP.x = A->x+r*(B->x-A->x);
A->x holds the value -40.0 and r*(B->x-A->x) is supposed to be 40.0
So I putted r*(B->x-A->x) in variable t so I then tried
theP.x = A->x+t;
that gives the same error. So I substituted A->x with -40.0 =>
same error.
So I substitute t with 40.0 and the error disappears.
So t holds a value not equal to 40.0 but if I inspect the value like
lwnotice("t=%.17e",t);
I get just 4.00000000000000000+01
Another interesting thing is that using an intermediate variable removes
the error in the stand alone version like:
{{{
#include <stdio.h>
main()
{
double r=1100.0/1375.0;
double t=r*(50);
double px = -40.0+r;
printf("r=%.16e\npx=%.16e\n",r, px);
}
}}}
So outside postgresql/postgis it works to put the value in an intermediate
variable to trunkate it. But not inside Postgis.
Why?
How come?
And where is the extra bytes saved inside postgis, when I have saved it to
a double?
Any hint is appreciated.
Thanks
Nicklas
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/703#comment:15>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-devel
mailing list