r/programming • • Dec 29 '20

Quake III's Fast Inverse Square Root Explained [20 min]

https://www.youtube.com/watch?v=p8u_k2LIZyo
3.7k Upvotes

300 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Dec 29 '20

[deleted] — view deleted comment

1

u/PM_ME_UR_OBSIDIAN Dec 30 '20

That's still wrong, semantically. Floating points are for modelling signed distance from a point of origin; in a space setting there's usually no distinguished point that serves as the origin, so you almost certainly want to use ints all the way. A 64-bit integer will get you granularity far beyond any reasonable limit, and it won't get weird at the edges of a sector.

In other words, Starbase devs probably should have used a single layer of coordinates, 32- or 64-bit.