AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Brauche Hilfe beim Umrechnen von INt64 Wert

Ein Thema von SimStar001 · begonnen am 17. Aug 2009 · letzter Beitrag vom 17. Aug 2009
Antwort Antwort
SimStar001

Registriert seit: 18. Jan 2008
594 Beiträge
 
#1

Brauche Hilfe beim Umrechnen von INt64 Wert

  Alt 17. Aug 2009, 16:30
Hallo, welchem Variablentyp entspricht S64? Int64?
  Mit Zitat antworten Zitat
Benutzerbild von turboPASCAL
turboPASCAL

Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
 
Delphi 6 Personal
 
#2

Re: Variablentypen?

  Alt 17. Aug 2009, 16:37
Was und woher kommt denn dein S64, C ?
Wie Schaut dort die Definition aus ?
Matti
Meine Software-Projekte - Homepage - Grüße vom Rüsselmops -Mops Mopser
  Mit Zitat antworten Zitat
SimStar001

Registriert seit: 18. Jan 2008
594 Beiträge
 
#3

Re: Variablentypen?

  Alt 17. Aug 2009, 16:44
aus dem Flight Simulator von Microsoft bzw der FSUIPC...
Var Type = S64 Size = 8 comment = #*360/(65536*65536*65536*65536))
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.136 Beiträge
 
Delphi 12 Athens
 
#4

Re: Variablentypen?

  Alt 17. Aug 2009, 16:57
size = 8 klingt schonmal nach 64 Bit

Aufgrund von /(65536*65536*65536*65536) (wer ist bloß auf diese komische Idee gekommen?)
würde ich eher zu UInt64 tendieren
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
SimStar001

Registriert seit: 18. Jan 2008
594 Beiträge
 
#5

Re: Variablentypen?

  Alt 17. Aug 2009, 17:53
s ich habe nochmal ne erklärung gefunden...

Zitat:
Longitude of aircraft in FS format.

To convert to Degrees:

If your compiler supports long long (64-bit) integers then use such a variable to simply copy this 64-bit value into a double floating point variable and multiply by 360.0/(65536.0 * 65536.0 * 65536.0 * 65536.0).

Otherwise you will have to handle the high 32-bits and the low 32-bits separately, combining them into one double floating point value (say dHi). To do, copy the high part (the 32-bit int at 056C) to one double and the low part (the 32-bit unsigned int at 0568) to another (say dLo). Remember that the low part is only part of a bigger number, so doesn’t have a sign of its own. Divide dLo by (65536.0 * 65536.0) to give it its proper magnitude compared to the high part, then either add it to or subtract it from dHi according to whether dHi is positive or negative. This preserves the integrity of the original positive or negative number. Finally multiply the result by 360.0/(65536.0 * 65536.0) to get degrees.

Either way, a negative result is West, positive East. If you did it all unsigned then values over 180.0 represent West longitudes of (360.0 – the value).

[Can be written to move aircraft: in FS2002 only in slew or pause states]

Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
var dwresult : dword;
    Longitude : int64;
    wert : int64;
    Latitude : int64;
    lat : extended;
    temp : string;
begin
  FSUIPC_Open(SIM_ANY, dwResult) ;
  if FSUIPC_Read($0568, 3, @wert, dwResult) then
  if FSUIPC_Process(dwResult) then
    begin
    wert := wert * 360;
    showmessage(floattostr( (wert/ 65536 / 65536 / 65536 /65536)));
    end;
end;
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:21 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz