public double highestEquivalentValue ( final double value ) { double nextNonEquivalentValue = nextNonEquivalentValue ( value ) ; // Theoretically, nextNonEquivalentValue - ulp(nextNonEquivalentValue) == nextNonEquivalentValue // is possible (if the ulp size switches right at nextNonEquivalentValue), so drop by 2 ulps and // increment back up to closest within-ulp value. double highestEquivalentValue = nextNonEquivalentValue - ( 2 * Math . ulp ( nextNonEquivalentValue ) ) ; while ( highestEquivalentValue + Math . ulp ( highestEquivalentValue ) < nextNonEquivalentValue ) { highestEquivalentValue += Math . ulp ( highestEquivalentValue ) ; } return highestEquivalentValue ; }
Get the highest value that is equivalent to the given value within the histogram s resolution . Where equivalent means that value samples recorded for any two equivalent values are counted in a common total count .