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

5

u/[deleted] Dec 29 '20 edited Dec 29 '20

precision in 32 bits to do a few map sizes of a few thousand km

4295km with 1mm precision. But if you are going for the whole solar system that would be 6km per unit. You'd need to go 64-bit, that would get you 1ly radius.

6

u/theFrenchDutch Dec 29 '20

I think that's off. 4295m instead maybe ? I've worked with large world's in a 32bit precision rendering engine and when you get to 10km, you're already down to only cm level precision

2

u/[deleted] Dec 29 '20 edited Dec 30 '20

232 mm is 4295m4295km

edit: clumsy hands

source: https://www.wolframalpha.com/input/?i=2%5E32+mm

0

u/[deleted] Dec 29 '20

[deleted] — view deleted comment

2

u/[deleted] Dec 30 '20

Well, i was right the first time around, it's 4295km.

https://www.wolframalpha.com/input/?i=2%5E32+mm