AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wandeln
Thema durchsuchen
Ansicht
Themen-Optionen

Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wandeln

Ein Thema von Delphiuser1987 · begonnen am 1. Jun 2010 · letzter Beitrag vom 2. Jun 2010
Antwort Antwort
gammatester

Registriert seit: 6. Dez 2005
999 Beiträge
 
#1

Re: Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wan

  Alt 1. Jun 2010, 15:23
Zitat von Delphiuser1987:
wie mache ich das mit dem wandeln ?????
Wenn Dein Ergebnis -8.7546383e^23 zu den 1.6 gehört, liegt es nicht an der Byte-Reihenfolge, hier eine function, die ein longint umdreht, via absolute longint und single kannst Du auch single umdrehen. Allerdings ist das Ergebnis für 1,6 dann -429492192.0! (in Bytes $CD $CC $CC $3F --> $3F $CC $CC $CD )
Delphi-Quellcode:
function RB(A: longint): longint;
  {-reverse byte order in longint}
begin
  RB := ((A and $FF) shl 24) or ((A and $FF00) shl 8) or ((A and $FF0000) shr 8) or ((A and longint($FF000000)) shr 24);
end;

var
  s: single;
  l: longint absolute s;
  ..
  l := RB(l);
  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 02:33 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz