WeSearch

Floor and Ceil versus Denormals on CPU and GPU

·5 min read · 0 reactions · 0 comments · 14 views
#programming#floating-point#computing
⚡ TL;DR · AI summary

The article discusses the behavior of floating-point numbers, particularly focusing on the functions floor, ceil, trunc, and round. It highlights the differences in handling subnormal numbers, also known as denormals, across various platforms. The author shares insights from tests conducted on CPU and GPU architectures regarding the preservation of denormals during these operations.

Key facts
Original article
Asawicki
Read full at Asawicki →
Opening excerpt (first ~120 words) tap to expand

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.

Excerpt limited to ~120 words for fair-use compliance. The full article is at Asawicki.

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from Asawicki