Jump to content
  • Advertisement
Sign in to follow this  
thorpe

Sending float/doubles over network

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

I've heard that different processors have different ways of representing floats and doubles (besides from the endian issue)? Is this true? I though everybody followed the IEEE-standard. How do I best send doubles and floats over a network connection?

Share this post


Link to post
Share on other sites
Advertisement
DEC Alpha can use the VAX (it's probably even PDP-11 compatible) legacy floating point format in addition to IEEE. I'm not sure which is default though.
Some machines with software floating-point emulation can use odd formats. At least AmigaOS does this (680x0) but there's probably many others too..

Personally I prefer to send floats as fixed-point numbers and even process them internally as such in some (*cough* most) cases. It's nice to save space and guarantee the precision when you already know the domain of your numbers.

Share this post


Link to post
Share on other sites
data compression, especially on some floats (or any type of data btw) where the range and minimum acceptable precision is known, is a good way to send information over a network connection. That removes the issue with different floating point representation standards. Also, having a compression (or data conversion) layer will take care of endianness for you. And that stuff can also be used to generally serialise data (saving-loading) as well. So well useful overall.

But nothing prevents you from sending floats as-is, if you are sure about the floating point formats, fpu precision modes, endianness, and what not.

Share this post


Link to post
Share on other sites
and I forgot, if you use delta-compression, then a decent data conversion scheme is necessary anyway. (delta-compression = Quake3 Networking model, where only change in the data sets are sent from one frame to another frame).

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!