2 ms·
> The third time he told this story, late-teenage-me pointed out that the curvature of spacetime under GR had more impact than the extra digits. That may be tr
by TeMPOraL 5y ago
> The third time he told this story, late-teenage-me pointed out that the curvature of spacetime under GR had more impact than the extra digits.
That may be true, but in simulations using floating points (which are, as 'mjburgess points out, discrete), there are discrete approximation errors that accumulate with almost any operation, on top of any measurement or modelling approximation errors you may have. On some problems, numerical integration on floats bleeds precision really fast.
I recall seeing some problems on numerics labs during university years, where using doubles instead of floats was what made the algorithm converge on a solution instead of endlessly spinning or diverging into infinity. I imagine that ideally, you'd use a more sophisticated algorithm instead[0] - perhaps one that simulates real numbers with greater precision. But computer power isn't infinite (and it certainly wasn't infinite in the last century) - floats and doubles are fast, supported by hardware, and you may need that speed to get results in a reasonable timeframe. Using doubles instead of floats may give you just enough precision buffer to make the faster algorithm work.
--
[0] - A trivial example that I'm sure is known to anyone doing physical simulations (including for videogames) is using increasingly sophisticated integrators for kinematics. You may start with naive Euler calculating v += aΔt, s += vΔt, but this quickly becomes inaccurate in quite spectacular ways (try simulating springs with naive Euler). So you may then progress through backwards / symplectic Euler, and end up with Verlet integration or even reaching for 4th Order Runge-Kutta, to keep the energy in the system more-less conserved as it evolves. And yes, the difference between floats and doubles is also very apparent, especially with Euler methods.
- gugagore 5y agoIt sort of sounds like you're confusing two different kinds of errors. Euler vs RK4 is an issue of truncation error. It's called that because when you approximate a derivative with a finite difference, you can see that you've truncated the infinite Taylor series. Truncation error is present even if there were zero approximation in the elementary floating point operations. I'm not sure how you mean that the difference between floats and doubles shows up with Euler methods especially. Under no floating point error, you can drive truncation error toward zero by driving the step size toward zero. But the floating point precision sets a floor on how low you can go. Perhaps this is what you meant.