Jump to content
The simFlight Network Forums

Recommended Posts

Posted

dear pete and all developers

i want to read bank angle offset with delphi i read someting but i need some format for this value

my code is this

function TFSUIPC.GetBankAngle: Real;
var
  deger : Integer;
  rDeger : Real;
begin
  FSUIPC_Open(SIM_Any,dwResult);
  FSUIPC_Read($057C, 4, @deger, dwResult);
  if FSUIPC_Process(dwResult) then
  begin
    rDeger := deger * 360 / (65536.0 * 65536.0);
    Result := rDeger;
  end else
  begin
    Result := 5;
  end;
end;

and return value is this

0,114295572042465

im not good numeric value formating with delphi i want to this result someting like this

20 degrees 10 degrees etc.

thank you for all helps

Posted
rDeger := deger * 360 / (65536.0 * 65536.0);

At which stage is your compiler converting the integer in "deger" to floating point? If this is AFTER the multiplication by 360 you are likely to lose most of the value though overflow!

Try

rDeger = deger; // Convert to floating ponit

rDeger = (rDeger * 360.0) / (65536.0 * 65536.0); // convert to degrees

Pete

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.