[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with arcs in gpic
From: |
Werner LEMBERG |
Subject: |
Re: Problem with arcs in gpic |
Date: |
Fri, 28 Aug 2009 17:13:49 +0200 (CEST) |
> Following up on my own report after poking through things this
> morning. In the src/preproc/pic directory, in file object.cpp, in
> the routine declared as "linear_object *object_spec::make_arc",
> lines 1833 and 1834 have the statement
>
> while (radius < d)
> radius *= 2.0;
>
> In my example, in some cases the test (radius < d) was satisfied,
> but the difference in the two values was on the order of 1e-10.
> Since radius was 0.1, doubling the radius leads to the fairly gross
> error that I was encountering. For the time being, my workaround is
> to replace that statement with
>
> if (radius < d)
> radius = d;
>
> which fixed my problem. The original code appears to have been
> intended to deal with the situation when radius is orders of
> magnitude less than d. My replacement code simply assigns radius
> the smallest value that avoids problems with the floating point
> code/libraries further on in the routine.
Your fix sounds reasonable. Thanks for the analysis! I don't see any
reason at all why there is this loop. In case noone objects I'll
apply your change within a few days.
Werner