bydamien Posted March 1, 2008 Report Posted March 1, 2008 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
Pete Dowson Posted March 1, 2008 Report Posted March 1, 2008 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now