using strictfp

Actually this post is a shameless reincarnation of a post i did earlier on this forum (http://www.java-gaming.org/forums/index.php?topic=11949.0)

I want to use floats for a game im working on, these float values will be send to a server to update the gamestate. I need a resolution of 2 digits after the fraction, will I need to use the strictfp identifier to ensure all clients/server will produce the same result, or wont that be an issue at that resolution?

Even when using strictfp, the precision will depend on the magnitude of your values. The most significant digits of a value are always maintained, so when floating point values get very large, the number of bits available to represent the digits after the decimal point is reduced.

You could always use fixed-point maths to guarantee the precision you need. Instead of defining, say, the speed of the spaceship in units of m/s, just multiply everything by 100 to use cm/s, and use integers.

or if your fancy and can’t be bothered about speed, use a the log base 10 of everything. That would bring all large data sets on the same scale as smaller ones, its a matter of doing Math.pow(10, value); to get your original value back.

DP

Or use doubles and just hope you never get outside their range!