On Tue, 26 Jul 2022 00:28:59 GMT, Sai Pradeep Dandem <[email protected]> wrote:

>> modules/javafx.controls/src/main/java/javafx/scene/control/TableUtil.java 
>> line 226:
>> 
>>> 224:         }
>>> 225: 
>>> 226:         if (Math.abs(colWidth - tableWidth) > 0) {
>> 
>> Related to Andy's question, shouldn't this be `> EPSILON` (for some small 
>> value of EPSILON), since floating-point arithmetic isn't precise?
>
> @kevinrushforth We can consider EPSILON with value of `.0000001`. This value 
> is already used in the same method for another bounds checking. Below is the 
> part of the code where it is used..
> 
> // Check for zero. This happens when the distribution of the delta
> // finishes early due to a series of "fixed" entries at the end.
> // In this case, lowerBound == upperBound, for all subsequent terms.
> double newSize;
> if (Math.abs(totalLowerBound - totalUpperBound) < .0000001) {
>     newSize = lowerBound;
> } else {
>     double f = (target - totalLowerBound) / (totalUpperBound - 
> totalLowerBound);
>     newSize = Math.round(lowerBound + f * (upperBound - lowerBound));
> }

I am also for declaring a constant


private static final double EPSILON = .0000001;


and using it in on lines 226 and  251.

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

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

Reply via email to