Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I don't know in details how exactly using floating point numbers to do so causes problem, but clearly it did cause problems for KSP.

I'm afraid that sums up the problem with your idea. You are positing a solution to a problem that you do not fully understand.

Almost all problems with floating point math are down to programming errors that accumulate, because intermediate values are wrongly rounded or truncated.

64-bit precision floating point math, with its 17 (16.94!) digits of decimal accuracy is more than capable of representing any given point within the Solar System in meters to the nearest millimetre. Problems only arise when absolute positional values are calculated by accumulating successive positions and their rounding errors.

That is to say: the naive way to track an objects position is to initialise it with a known starting point -- say the top of a rocket stack at some lat/long here on earth -- and then modify its position every time period (say, once per second) using the last known position as the input to the next time cycle.

The problem with this is that at each stage, tiny absolute representation errors can occur. Individually, these tiny errors in the 17 (decimal) significant digit are inconsequential; but each time the calculation is repeated, they can build up to the point of significance.

There are many techniques for avoiding those accumulated errors -- a whole branch of mathematics is dedicated to exactly that, which I do not know well enough to attempt a summary of here.

Even if the game required greater accuracy that could be achieved with 64-bit FP, moving to infinite precision irrational math as a response would be to take a sledgehammer to crack a nut. A simple move to 80-bit (21 significant digits) or 128-bit (34 sig. fig.) is a relatively simple change with minimal performance impact, that ensures that rounding errors would take trillions of repetitions - 1 trillion calculations at 1 per second represents a game time of ~11.6 million years! -- before they accumulate to anything significant.

But even that is overkill for a game. If the math is done correctly, 64-bit FP is more than good enough for real life problems like manned space flight and modeling nuclear weapons. It is certainly good enough for games where the speed of computation is far more critical than the accuracy.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong


In reply to Re^7: Irrational numbers by BrowserUk
in thread Irrational numbers by grondilu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (3)
    As of 2014-10-26 00:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (149 votes), past polls