Skip to content

FloatMath 5.46.0 ​

final class · pocketmine\world\generator\vanilla\math\FloatMath · source

Single precision helpers. PHP only has doubles, so float32 results are emulated by rounding.

Methods ​

fround() ​

php
public static function fround(float $x) : float

Rounds a double to the nearest float32 value (ties to even), like Java's (float) cast or JS Math.fround(). Uses Veltkamp splitting (2^29 + 1), which is exact for every finite value in the normal float32 range and much faster than pack()/unpack(). Code generators inline the same expression.

lerp() ​

php
public static function lerp(float $a, float $b, float $c) : float

float32 lerp: fround(b + fround(a * fround(c - b)))

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.