Jump to content
The simFlight Network Forums

float 64 / Byte


Recommended Posts

Converting Float to Byte.

Er, the range of a byte is -128 to +127. The range of a float exceeds than by trillions in both the itegral and fractional directions. There's really no way unless you know the float's value is within that very very small range.

I have to read AILRON_DEFLECTION ofset 2EA8.

As other interesting values this one is a Float64.

What is the math. to convert into a Byte or a Word?

It can't be done that easily. A Float64 has a number of bits as an exponent and the rest of the bits as mantissa, normalised so that there's one integral digit (i.e. 1). The bit assignments are documented in Intel technical specs. I can fish them out if you like, but there's no easy conversion. If you write in a decent language like C/C++ then the compiler will convert for you using the appropriate floating point register to fixed posint register transfer instructions.

Regards,

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.