dallas Posted November 9, 2007 Report Posted November 9, 2007 I've been trying for awhile to translate an 8 byte floating point double value, specifically at Offset 0x6058 (FS2004 GPS cross track error), but can't seem to make sense of what I get back from FS2004. I thought it would be similar to getting the Latitude value at 0x0560 where using C# I just copy the quad word value into a double floating point variable then multiply by 90.0/(10001750.0 * 65536.0 * 65536.0), but I was wrong. Can anyone help me?
Pete Dowson Posted November 14, 2007 Report Posted November 14, 2007 I've been trying for awhile to translate an 8 byte floating point double value, specifically at Offset 0x6058 (FS2004 GPS cross track error), but can't seem to make sense of what I get back from FS2004. I thought it would be similar to getting the Latitude value at 0x0560 where using C# I just copy the quad word value into a double floating point variable then multiply by 90.0/(10001750.0 * 65536.0 * 65536.0), but I was wrong. The Latitude value at 0560 is NOT floating point, but fixed point. Where a floating point value is documented, you simply read it directly into a floating point variable. Do not convert it into floating point, it is already floating point! Pete
dallas Posted November 14, 2007 Author Report Posted November 14, 2007 Pete, Sorry I wasn't more clear in my first question: I was using the latitude offset as an example of how I got the correct value from fsuipc. The problem I have is that when I try to get the value of say Offset 0x6058 (FS2004 GPS cross-track error) it doesn't make sense. If I use the same method that I use for latitude I get a very large number. Dallas
Pete Dowson Posted November 14, 2007 Report Posted November 14, 2007 The problem I have is that when I try to get the value of say Offset 0x6058 (FS2004 GPS cross-track error) it doesn't make sense. If I use the same method that I use for latitude I get a very large number. You should not use the same method as you use for the latitude. That is the point. It will, indeed, look like a huge number if you do that, because floating point format is completely different to fixed point. You need to read floating point values directly into floating point variables (easy in C or C++), or at least copy them over in a way which doesn't convert them -- unlike your method for the latitude. I'm afraid I cannot help further with your language. If you don't know how to use its floating point variables perhaps someone else will be able to help. Regards Pete
Recommended Posts