Jump to content
The simFlight Network Forums

Calcluations


Recommended Posts

Perhaps, anyone here can help me out for clarfication on Calcluations, not only that, but a proper way implementing code lanuage on calculations. I spend the whole day trying to figure it out and not one :evil: DARN :evil: thing has gone through my head yet.

One example:

Offset=02CC

User=Whiskey Compass

BitSize=8

I believe double float has something to do with 64-bit integers, and Visual Basic 6 probably not be able to compile itt, However, from my understanding... I would need to spilt it seprately into 32-bit if I am correct. So from my assumpuation it means I calcuate :

360.0/(65536.0*65536.0) =83.8 something

270.0/(65536.0*65536.0)=213,8 something

180.0/(65536.0*65536.0)=41.9 something

90.0/(65536.0*65536.0)=20.9 some

Language implement I assume:

If FSUIPC_Read(&H2CC, 8, VarPtr(Compass),dwResult) Then

If FSUIPC_Process(dwResult) Then

lblCmp.caption = Format (Compass,(dHi), 360.0/(65536.0*65536.0)

(Compass,(dHi), 270.0/(65536.0*65536.0)

(Compass,(dLo), 180.0/(65536.0*65536.0)

(Compass, (dLo), 90.0/(65536.0*65536.0)

Did I calculate it right? How about implementing? If not, a better claification from you would be appreicated.

One more thing, are there any Offset values for Altitude (not in slew or pause state) for FS2002???

Link to comment
Share on other sites

Well, in the VB SDK it states that VB does not do 64 bit info. BUT you can cheat it.

Use a Currency variable for Floating 64

Then use that Fake64Bit and do your calculations with doubles to prevent overflows....

A = Fake64Bit

A = 360# / (65536.0#*65536.0#)

The # forces the double. Without it you will get overflow errors

Mike

Link to comment
Share on other sites

  • 3 weeks later...

Sorry for the delay in replying -- I've been on holiday with no Internet access. I'm just trying to catch up with an enormous backlog now!

Offset=02CC

User=Whiskey Compass

BitSize=8

I believe double float has something to do with 64-bit integers, and Visual Basic 6 probably not be able to compile itt

"double" floats are the standard floating point format on Intel processors and are, as far as I know, universally supported. They are most certainly not 64-bit integers which are hardly supported by anything.

You should be able to just read the 8 bytes directly into a standard floating point varaible, whatever they are called in Visual Basic! In the reply you got from Mike this seems to provide the answer: "Use a Currency variable for Floating 64".

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.