cross-posted from: https://lemmy.ml/post/24332731

Stolen Cross-posted from here: https://fosstodon.org/@foo/113731569632505985

Omni-Man looking at the IEEE 754 Single Precision Floating-Point Standard and saying "look what they need to mimic a fraction" with the rest of the meme whited out
you are viewing a single comment's thread
view the rest of the comments
[–] 5 points 2 years ago (2 children)

In game dev it’s pretty common. Lots of stuff is built on floating point and balancing quality and performance, so we can’t just switch to double when things start getting janky as we can’t afford the cost, so instead we actually have to think and work out the limits of 32 bit floats.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 2 years ago (1 child)

    So you have to remember how it's represented in the system with how the bits are used? Or you just have to remember some general rules that "if you do that, it'll fuck up."

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 2 years ago

    Well, rules like “all integers can be represented up to 2^24” and “10^-38 is where denormalisation happens” are helpful, but I often have to figure out why I got a dodgy value from first principles, floating point is too complicated to solve every problem with 3 general rules.

    I wrote a float from string function once which obviously requires the details (intentionally low quality and limited but faster variant since the standard version was way too slow).

  • source
  • parent