mojira.dev
MC-181312

Mth.ceil(float) and Mth.ceil(double) can overflow

The bug

20w17a, Mojang names

The methods net.minecraft.util.Mth.ceil(float) and ceil(double) are supposed to return the smallest int which is equal or greater than the given float / double.
The problem is that if the argument is > Integer.MAX_VALUE, the result overflows and becomes Integer.MIN_VALUE.

Maybe that is acceptable though because usually these methods are not called with such high values.

Comments 1

The Mth code is not intended to be safe - or even "correct".

Any bugs caused by this should be individual issues describing the bug.

marcono1234

(Unassigned)

Plausible

(Unassigned)

20w17a

Retrieved