Why floats suck - accurate galaxy-wide coordinates in 128 bits
I am an astrophysicist, and I deal with this issue directly.  In my simulations, I do deeply nested Adaptive Mesh Refinement calculations.  These simulations run inside an Eulerian grid, where each cell contains a fluid element.  These cells are collected into grid patches.  When a cell inside a given grid exceeds some criteria, we refine it by inserting 8 cells; the next level of cells are then collected and minimum bounding boxes are created that cover the flagged cells, and we compute now at an additional 'level' of refinement.<p>My research concerns the formation of the first stars in the universe.  In order to set up the initial conditions of these objects correctly, we have to resolve fluctuations in the background density of the Universe on the scale of kiloparsecs.  However, we are also mostly concerned about how the fluid behaves on much smaller scales, at the tens to hundreds to thousands of AU scale, all the way down to the radius of the sun or even lower.<p>In one of my "stunt" runs, I ran up to 42 levels of refinement inside a box; this means that the dynamic range between the coarsest cells and the finest cells was 2^42.  For the most part, however, we only use about 30-33 levels of refinement.  In order to attain this resolution, we utilize extended precision positioning.  (Future versions of the code will utilize integer positioning with relative offsets for Lagrangian elements like particles.)  Inserting this functionality into the code took quite a bit of debugging and testing, in particular because we had to account for differences in how Intel, PGI and GNU passed extended precision values back and forth between Fortran and C.<p>I have uploaded a very simple 2D zoomin movie of one of these simulations, which only had 30 levels of refinement, to Vimeo.  It's busy converting as I write this, but it will be found here when it has completed: <a href="http://vimeo.com/23176123" rel="nofollow">http://vimeo.com/23176123</a>