TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why you should be careful about 'optimizations'

5 pointsby Arcanisabout 13 years ago

2 comments

mattst88about 13 years ago
&#62; So 5.4 | 0 will gives 5, which is a flooring operation. However, -5.4 will give -5. And that’s a ceiling operation.<p>So, | is actually doing a round toward zero. It seems like the problem described is actually caused by simply misunderstanding what the floor function does (round toward negative infinity).
Palomidesabout 13 years ago
I sympathise, but doing bitwise operations on floating point values without care is just asking for it