|
From: Philipp K. J. <ja...@ie...> - 2014-11-28 18:39:05
|
Forwarding HBB's response to the list... (and my response below) Begin forwarded message: Date: Fri, 28 Nov 2014 19:31:46 +0100 From: Hans-Bernhard Bröker <HBB...@t-...> To: "Philipp K. Janert" <ja...@ie...> Subject: Re: "Polygon not closed" warning - rounding error? Am 28.11.2014 um 18:58 schrieb Philipp K. Janert: > If I issue the following two commands (in a fresh 5.0rc3 session): FWIW, 4.6pl6 Win32 does the same. > set object 1 polygon from -0.9,0.9 rto 0.8,0 rto 0,-0.8 rto -0.8,0 > rto 0,0.8 set object 2 polygon from 0.1,0.9 rto 0.8,0 rto 0,-0.8 rto > -0.8,0 rto 0,0.8 > then gnuplot complains that the second polygon is not closed (and > that gnuplot is adding a vertex). > Is this due to internal roundoff, so that the endpoint != startpoint > in floating point arithmetic? Somewhat obviously: yes. This is a relatively clear example of In computing, 10 times 0.1 is hardly ever 1.0 > It did confuse me for a while (did I do something wrong?). Might it > be possible to suppress such warnings? Only at the cost of getting a non-closed polygon, which would be a good deal worse. PKJ: I disagree. If the warning is in fact due to round-off (which I don't know - it might be due to a bug in the code, for instance; I did not look at the implementation), then it would be possible to suppress such warnings if the length of the "missing vertex" is sufficiently small (compared to the rest of the polygon?). After all, using straight equality in floating point arithmetic is rarely the right thing to do. |