|
From: Daniel J S. <dan...@ie...> - 2006-06-25 23:23:17
|
I've placed a patch under bug report [ 1004754 ] on SourceForge that is a cleanup of the tic generation. I think it would be worth considering for 4.2, because it does fix the bug and it is much friendlier computer math and programming wise in my opinion--very clean. I think I've covered everything, such that there is a good chance any outstanding tic placement bugs should have been addressed by this. Please take a look at the patch and see what you think. I've put detailed comments at the key points. It should be clear in the patch why things are done the way they are. There really isn't too much changed. Now is the best time to work on this, since it is fresh and I will soon get busy on other projects. The reason I think what this patch is an improvement is that it handles rounding artifacts in several different places where they crop up rather than trying to solve them all with a single conditional test right before the tic-placement in the for-loop. This patch does not have any type of SIGNIF and tolerance based upon the range. It only deals with rounding effects at the level of DBL_EPSILON or order thereof. Furthermore, the tic placement is done more in an integerized fashion, i.e., an integer start and integer end corresponding to the start and end values after factoring out the step increment are computed. We then know before entering the loop what the number of intervals, N_int, should be. (An interval is the major tic with the group of potential minor tics to its positive side.) Being more accurate with respect to the integer equivalents, the code address any roundoff problem with the major tic end point as: /* Address rounding issues in the following way */ if (i_tic == (N_int - 1)) tic = end; else tic = start + i_tic * step; to avoid losing a tic at the end range. I've checked every example in 'all.dem' for consistency before and after the patch and that the patch fixes the bug of grid lines sometimes landing outside the borders. In fact, 'all.dem' helped a great deal for debugging. Dan |