Skip to main content

fast_floor

Function fast_floor 

Source
pub(in worldgen::feature) fn fast_floor(
    v: f64,
) -> i32
Expand description

Floor function that matches Java behavior.

In Java, (int)v truncates toward zero, but we need floor behavior. For negative values, we need to subtract 1 if there’s a fractional part.

Fast Floor from Stefan Gustavson’s in “Simplex Noise Demystified” 2005 paper

Java reference: Mth.floor(double)