On Thu, 11 Aug 2022 20:51:50 GMT, Marius Hanl <mh...@openjdk.org> wrote:

>> I am also for declaring a constant
>> 
>> 
>> private static final double EPSILON = .0000001;
>> 
>> 
>> and using it in on lines 226 and  251.
>
> Just a question out of curiosity, is there some kind of recommended value for 
> epsilon? 
> I remember we also have very small epsilon in `Region` for snapping.

This is a *good* question.
In this case, we are summing column widths, so we can estimate the worst case 
scenario by simply adding max errors accumulated after each addition:

sum(N * 2 * ε * |w|)

where
N = number of columns
ε = upper bound for rounding error, or epsilon which is about 1e-16 [0]
w = column width

So, plugging a 100 columns of 200 px wide we get something to the order of 
1e-12 .. 1e-11.

On a side note, we could have used Unicode here

private static final double ε = .0000001;


[0] https://en.wikipedia.org/wiki/Machine_epsilon
[1] https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

-------------

PR: https://git.openjdk.org/jfx/pull/848

Reply via email to