Jump to content
  • Advertisement
Sign in to follow this  
Robinhood

Puzzle On Convertion of Float Data

This topic is 4237 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,I am currently working on a data packeting program and I've got puzzle on data of float type.The manual said: The longitude(float) should be 28 bit,thus the hex should be 0x6791AC0. But my result is 0x435A8000. So I can't figure it out. Hope someone can help.

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure what there is to sort out.

So you can only send a 28 bit float in your packet, right?

Share this post


Link to post
Share on other sites
I'm curious, how are your sending 28 bits down a socket, to my knowledge sockets send in characters. I assume you are appending two different pieces of information to gether into a float, or something. So like 28 bits of it are the longitude and the remaining 4 bits are some other variable.

Otherwise i cant see how you can send it down.

If the above is true, use bit masking and bit shifting to move things around the 32 bits of the float you are sending.

Dave

Share this post


Link to post
Share on other sites
It is the most siginificant bits, the high-order bits, ie the ones worth the most. It firstly depends on the endianness of the machine so you need to find that out. It is most likely little endian, but you can't take that for granted. Google for an exaple of how to work out the endianness of a machine.

Dave

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!