Jump to content
  • Advertisement
Sign in to follow this  
newOperator

scale if I use a double or float in java

This topic is 5408 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

Anyone, I'm trying to make a map -- probably miles wide and long (around 200miles) but I'm not sure of what type to use for Point2D in java. Point2D.Float or Point2d.Double? I'm sure it will make difference in the long run, I don't know. me

Share this post


Link to post
Share on other sites
Advertisement
What is the shortest distance that will matter? That is, how accurately do you want to be able to represent positions on the map?

Share this post


Link to post
Share on other sites
In that case, float will be fine. The IEEE single-precision floating point number (the "float" type in C/C++/Java) has 23 bits of mantissa, which means the smallest representable delta (the "epsilon" value) at the maximum represented magnitude (in your case, the edge of the map) is approximately 2^32. For a map with a radius of 200 miles, this works out to a maximum epsilon value of around 1.5 inches. So you'll be fine with single-precision. (In case you're wondering, double precision has 52 bits of mantissa. That's enough for a maximum epsilon of less than one angstrom. An angstrom is really really tiny.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!