Subject: CGAL users discussion list
List archive
- From: Camille Wormser <>
- To:
- Subject: Re: [cgal-discuss] point lying over a line problem
- Date: Wed, 23 Jul 2008 23:55:25 +0200
You should try to understand why you were advised to use precision(20). The trailing numbers that you see are not at all garbage. They are the REAL digits of the EXACT binary number which is stored in memory. The fact that you do not see exactly 0.034, for example, shows that the number stored in memory is NOT EXACTLY 0.034, but a slightly larger number. This is unrelated to CGAL. It is the standard C behavior. You can easily check that in detail: the stored (double, used by CGAL) value for 0.034 is 0.000010001011010000111001010110000001000001100010010011100 and the real value is 0.000010001011010000111001010110000001000001100010010011011101000001... As you can see, 0.034 is rounded in memory to the nearest double precision floating point number (which happens to be larger than 0.034, hence the 0.034000000000000002442 output, with precision(20)). CGAL can only use the data that you provide, i.e. the data IN MEMORY, not the data in your source file. Using precision(20) makes sense, because it allows you to check that CGAL's answer is indeed the correct one. As for providing inexact answers in case the data are close to be in a degenerate position, check any course in computational geometry to find examples where such an approach will fail: it will not be a question of having a less precise answer, but a crashed program. Very few algorithms exist for dealing with imprecise data, and they are very tricky to design.
In kernel_ftC2.h, you will find
|
- Re: [cgal-discuss] point lying over a line problem, (continued)
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Sylvain Pion, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Sylvain Pion, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Sylvain Pion, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Fernando Cacciola, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
- Re: [cgal-discuss] point lying over a line problem, Camille Wormser, 07/23/2008
- RE: [cgal-discuss] point lying over a line problem, Xiaofan Li, 07/24/2008
- Re: [cgal-discuss] point lying over a line problem, Alejandro Aragon, 07/23/2008
Archive powered by MHonArc 2.6.16.