That one is not that complicated if you don’t think about the math. It’s basically just if we interpret the float as int and add a magic number we have a good estimation.
From what I remember at least, it’s been a little while since I implemented it.
On the other hand, it made webpages way less flexible.
Like yesterday (i have the browser not in fullscreen, for reasons) on my 16" fullhd notebook, webdev couldn’t imagine that someone would use his site in a ~1000px browser window, sidebars left and right, the main content about 20 characters wide squeezed inbetween. So i pressed f12 and deleted the sidebars. But the content was still 20em wide, because of flexbox.
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
Posts must be relevant to programming, programmers, or computer science.
No NSFW content.
Jokes must be in good taste. No hate speech, bigotry, etc.
missing the stage of C where it’s all incomprehensible bitfucking with comments like “this works, i do not know why it works, do not touch this”
Real fast inverse square root algorithm hours
That one is not that complicated if you don’t think about the math. It’s basically just if we interpret the float as int and add a magic number we have a good estimation.
From what I remember at least, it’s been a little while since I implemented it.
IIRC also relying on how floating-point is basically scientific notation and the most-significant bits are the exponent.
And most importantly, relying on how a sloppy answer works just fine. The most important skill in game development is cheating.
Makes me feel better about my own game dev attempts lmao.
I was more thinking of the comments which are pretty much exactly what you said (“incomprehensible bit hacks” followed by “what the FUCK?”)
C should show some overflow corruption of the problem graphic.
I had this in CSS.
CSS isn’t as bad these days if you use Flexbox. Debugging floats and absolute/relative positioning was a nightmare in comparison.
On the other hand, it made webpages way less flexible.
Like yesterday (i have the browser not in fullscreen, for reasons) on my 16" fullhd notebook, webdev couldn’t imagine that someone would use his site in a ~1000px browser window, sidebars left and right, the main content about 20 characters wide squeezed inbetween. So i pressed f12 and deleted the sidebars. But the content was still 20em wide, because of flexbox.