Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Nanoprobe

[Hello!] Floating point accuracy

This topic is 6932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all! I''m Nanoprobe. You may know me from such message boards as the Independence War fourum... yada yada yada... Now that I have that bit over with, I have this question. I am creating a 3d engine to play with (possibly to make a game on), and I want it to be mainly a space engine. I have this idea that if I use 3 long integers and 3 doubles to define a co-ordinate, the floating point numbers can refer to a ''sector'' of space defined by the longs. That''s the best way I can explain it. Anyway, the way I have it worked out is that if 1 using a long integer equals 1 million kilometres as a double, my gameworld could be made up of a cube of space over 400 light years from one side to another, accurate down to the centimetre! Is this right, or have I gone wrong somewhere? Also, if I end up making a space game with this engine, would accuacy to 1cm do? Or should I go to, say, 1 long unit = 100,000 double units?
- Nanoprobe

E-Mail

Colliderring.com

ICQ# 48856642

Share this post


Link to post
Share on other sites
Advertisement
Hi Nanoprobe!

You calculations are correct.
A double has got 11 exponent bits, 52 accuracy bits.
10000000 km = 100000000000000 µm
and 2^52 = 4503599627370496 so this would be accurate enough!

Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
Share on other sites
400 cubic light years? Now, what are you gonna put in it (I want a solar system at grid co-ordinate [4][11][15] please )?

I''m talking gibberish now so i''ll stop

MENTAL

Share this post


Link to post
Share on other sites
Just as I thought, thanks guys!

I did end up to coding to 200,000 wide sectors, and added a reference point to the reference point.

I now roughly gave myself enough space to make the entire galactic cluster.

I think I might hang around on this board for a while too, and I''ll tell you about my engine as I go along. I think I like this board better than the Independence War one because you get icons and it saves my HTML sig.



- Nanoprobe

E-Mail

Colliderring.com

ICQ# 48856642

Share this post


Link to post
Share on other sites
Okay, if you''re near light speed, the distance seems much shorter, but not for those who stay on earth - they''ll all be dead when you''re back.....

Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!