Limits of double precision

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Limits of double precision

Postby pHySiQuE » Thu Nov 02, 2017 7:44 am

With 32-bit floating points we tend to run into visible problems at about 8000 units away from the origin. I was wondering what the practical limits of double precision floating points would be? The planet Pluto is 5,906,380,000 kilometers from the sun. If the sun is the origin, could be run a simulation at a distance like that and have sub-millimeter accuracy with double precision floating points?
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Limits of double precision

Postby Julio Jerez » Thu Nov 02, 2017 10:24 am

double precision support 17 digits mantissa, so yes assuming the sun was the origin, two object in Pluto will have about 7 digits of resolution.

I would say that double is enough to cover the vicinity of a light year which about 1e-13 km at submillimeter precision
but who is doing that?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Limits of double precision

Postby blackbird_dream » Thu Nov 02, 2017 10:28 am

astrophysicians
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: Limits of double precision

Postby Julio Jerez » Thu Nov 02, 2017 6:37 pm

I believe astrophysics simulation use Lagrange and Hamilton dynamics to solve large problem of celestial bodies.
In particular they us a trick called "the central force problem"

this is a method that allows to cluster group of bodies that are far away form other bodies and resolve the as if they were a single body
for example say you want to simulate the solar system with all planes, moons, and satellite etc.

use the central force formulation, the earth moon is a local body with a center, Jupiter is another central body. and so on.

the this system is no hundred of body is a hierarchical system with 9 bodies, and each body has few child bodies. Now each one of those subsystem can use different scale.

if you want to extend that so the galaxy, the each solar system is a child. of the black hole at the center, and for you want to extend that to the cluster of galaxy the each galaxy is a central system and so on until you can cover the entire visible universe.

notice that the central problem is no a trick or an approximation, this is a presides method the yield the correct solution if the principle of least action is valid.
on the other hand the brute force approach lead to a degenerated simulation doe to the accumulation error.

this lagrigyan and Hamiltonian simulation are at the front for eh prediction of Dark Matter, Dark Energy, and even the 9 or 10 earth planet. which apparently has to be form four to ten earth massed in other for the solar system to be the way it is.

all solar system simulation produce a chaotic system unless they add a 10 heavy planet and they also predict that the plane should be there somewhere.

here is an animation of who a tow body central problem will look.
https://www.google.com/search?q=body+center+moon+earth&rlz=1C1GGRV_enUS751US751&tbm=isch&source=iu&pf=m&ictx=1&fir=DJ75Bkn6swIOYM%253A%252CUPgIMFAOQq1LaM%252C_&usg=__RtKkePVMNLRHwLAn8BEcseNOOZc%3D&sa=X&ved=0ahUKEwjf4bKs1KDXAhUW1WMKHew-AngQ9QEIRDAE#imgrc=DJ75Bkn6swIOYM:
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Limits of double precision

Postby Leadwerks » Thu Oct 31, 2019 5:09 am

I actually worked out the math on this. Double floats have 15 significant digits:
https://docs.microsoft.com/en-us/cpp/c- ... ew=vs-2019

According to my calculations you can simulate an area as far out as Jupiter's furthest orbit, with millimeter precision.

You can simulate an area as far as Pluto's furthest orbit with centimeter precision.

We are actually using this for NASA projects and it works.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Limits of double precision

Postby misho » Sun Nov 03, 2019 6:29 pm

This is very pertinent to my project as well - I am working on a spaceflight simulator and I had a similar discussion about this with Julio about 3 years ago, when I was inquiring about the feasibility of Newton for spaceflight applications. In my experience, there is no problem with Newton whatsoever regarding precision. My bottleneck is that my visual display system (or, a server) that I am using is implemented in single precision, which is internally limited (that is, my server imposes internal limit which is not extendable) to exactly 30 480 000 meters. I have no idea what is the significance of that number as far as float vs. double.

This forces me to do some trickery: for a trip to, say, Moon, at some point in Low Earth Orbit, but short of above value, I have to overlay a graphic of trajectory, showing where the spacecraft is, and not letting user see or interact with actual 3D spacecraft view. Just as well, at this point, the trip is "boring" and user would accelerate time anyway, until they reached Moon. Upon reaching Moon, I compute entry vector, "shift" the coordinate system from Earth's to Moon's, and insert the spacecraft on the new vector in Moon's coordinate system.

The problem I have currently is, while on this highly elliptical trajectory from Earth to Moon, the parameters of the trajectory are constantly changing, and this shouldn't be happening - the orbital parameters (perigee, apogee, eccentricity ... ) should remain fixed if the spacecraft is not under power, and the only force acting on it is Earth's force of gravity (which is the case in my scenario). This is what Julio and I are discussing in my other post under "Bugs and Fixes" forum.
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Limits of double precision

Postby Leadwerks » Mon Nov 04, 2019 10:02 am

You might be interested in our new engine, when it comes out. We are using double floating points for the rendering, and we can render the moon and sun to-scale from the Earth.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Limits of double precision

Postby misho » Tue Nov 05, 2019 1:48 pm

Sounds interesting! Keep us posted, I'll check it out!
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Limits of double precision

Postby JernejL » Tue Nov 05, 2019 2:09 pm

Leadwerks wrote:You might be interested in our new engine, when it comes out. We are using double floating points for the rendering, and we can render the moon and sun to-scale from the Earth.


Nice work, did you also do any kind of performance comparisons to single floats?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Limits of double precision

Postby Leadwerks » Wed Nov 06, 2019 6:44 am

When your vertex pipeline becomes the bottleneck (millions of vertices) the speed is roughly half.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 20 guests

cron