Menu

πŸ“°
0

Floor and Ceil Versus Denormals on CPU and GPU

asawicki.infoΒ·asawicki.infoΒ·4 months ago
#a7B3ButY
#math#gpu#denormals#rounding#article#ama
Reading 0:00
15s threshold

Sat 23 May 2026 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.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More