I'm not an expert on this but I think floating point arithmetic is not
absolutely precise. For example my computer gives this result 0.1*0.1 =
0.010000000000000002. I think it has to do with the fact that some numbers
(like 0.1) are periodic when expressed in binary and computers can only
store a finite number of decimals. Maybe you can work with a tolerance.


On Tue, May 19, 2009 at 2:03 PM, Anke Trittenbach
<[email protected]>wrote:

> Hello all together,
>
> I have a problem and I hope you can help me with this.
>
> My intersection operation for geometries doesn’t return the correct result
> when the geometries have many decimal places.
> There is a method for checking if a point lays on a straight line. In this
> method the slope and the intersection with Y-Axis of the straight line is
> calculated. With this and the x-coordinate of the point the method
> calculates the y-coordinate which should the point have if the point would
> lay on the straight line. Then this and the real y-coordinate will be
> compared. If they are equal the point lays on the line. But this doesn’t
> work correct. Sometimes the method returns that the point does not lay on
> the straight line, because the calculated values differ with a value of
> 0.000000000004. But in reality the point lays on the straight line.
>
> Does somebody know if the calculation is wrong? Or how did you avoid such
> kinds of problems? Does this problem maybe deals with the precision or the
> tolerance?
>
> With kind regards and thanks for your help.
>
> Anke Trittenbach
>
> --
> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
> Telefonanschluss für nur 17,95 Euro/mtl.!*
> http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
> _______________________________________________
> jts-devel mailing list
> [email protected]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>



-- 
Fernando González Cortés
Ingeniero informático,
http://fergonco.scienceontheweb.net
_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to