GPU floor() Bugs š¤, C# Books š, Mewgenics Internals š±
āļø Deep Dives into Engine Internals
The Surprising Non-Determinism of floor() on GPUs (and How to Fix It)
A tiny subnormal float exposes a big problem in GPU math: floor(-1.1754939e-38) can be -1.0 on CPU but -0.0 on GPU. This post explains how denormals work, why many GPUs flush them for performance, and how that breaks assumptions about floor/ceil behavior and cross-platform determinism. Using real tests across Nvidia, Intel, and AMD hardware, the author maps the differences. He then offers deterministic HLSL replacements for floor and ceil that...
