On Fri, 11 Feb 2022 11:55:13 GMT, stefan-zobel <d...@openjdk.java.net> wrote:

> > I investigated most of the usages. They just give a size, and get a 
> > capacity, even not change the 0.75 So maybe we can use some int calculation 
> > to replace the 0.75, thus replace Math.ceil for such situations.
> 
> FWIW, `(int) Math.ceil(expected / 0.75)` and `(int) ((expected * 4L + 2L) / 
> 3L)` would be equivalent.

Yes,  and `(int) ((expected * 4L + 2L) / 3L)` actually equals `(expected + 
(expected + 2) / 3)` IMO, thus even avoid cast to long.

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

PR: https://git.openjdk.java.net/jdk/pull/7431

Reply via email to