Floor and Ceil Versus Denormals on CPU and GPU 0 ▲ Adam Sawicki - Homepage 190 days ago · 5 min read1023 words · Tech · hide · Fediverse post Recently, I dove deep into floating-point numbers and their behavior. Somehow, this topic haunts me in my programming practice since I created Floating-Point Formats Cheatsheet back in 2013 and also released a comprehensive article The Secrets of Floating-Point Numbers in 2024. This time, I would like to focus on one specific question: What is the result of floor(-1.175493930432748e-38) ? Note: Hexadecimal value of our input number is 0x807FFFFD. Floor, ceil, trunc, round To recap, floor, ceil, trunc, round are functions available in the standard library of C, C++, as well as shading languages: HLSL and GLSL. Each of them transforms a floating-point number into an integral floating-point value, but using different rounding rules. Note this is not about a conversion from float to int. The result of these functions is still a float, just having only integral part. When the input is already integral, the value is returned as-is. Otherwise, it gets "snapped" to the nearest integer in a… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town