Anzeigen: Delphi C++
Anzeigeeinstellungen

System.TSingleRec

Aus XE2 API Documentation
Wechseln zu: Navigation, Suche

Delphi

  TSingleRec = packed record
  private
    function GetExp: UInt64; inline;
    function GetFrac: UInt64; inline;
    function GetSign: Boolean; inline;
    procedure SetExp(NewExp: UInt64);
    procedure SetFrac(NewFrac: UInt64);
    procedure SetSign(NewSign: Boolean);
  public
    function Exponent: Integer;
    function Fraction: Extended;
    function Mantissa: UInt64;
    property Sign: Boolean read GetSign write SetSign;
    property Exp: UInt64 read GetExp write SetExp;
    property Frac: UInt64 read GetFrac write SetFrac;
    function SpecialType: TFloatSpecial;
    procedure BuildUp(const SignFlag: Boolean; const Mantissa: UInt64; const Exponent: Integer);
    class operator Explicit(a: Extended): TSingleRec;
    class operator Explicit(a: TSingleRec): Extended;
    case Integer of
    0: (Words: array [0..1] of UInt16);
    1: (Bytes: array[0..3] of UInt8);
  end;

C++

struct DECLSPEC_DRECORD TSingleRec{
private:
unsigned __int64 __fastcall GetExp(void);
unsigned __int64 __fastcall GetFrac(void);
bool __fastcall GetSign(void);
void __fastcall SetExp(unsigned __int64 NewExp);
void __fastcall SetFrac(unsigned __int64 NewFrac);
void __fastcall SetSign(bool NewSign);
public:
int __fastcall Exponent(void);
Extended __fastcall Fraction(void);
unsigned __int64 __fastcall Mantissa(void);
__property bool Sign = {read=GetSign, write=SetSign};
__property unsigned __int64 Exp = {read=GetExp, write=SetExp};
__property unsigned __int64 Frac = {read=GetFrac, write=SetFrac};
TFloatSpecial __fastcall SpecialType(void);
void __fastcall BuildUp(const bool SignFlag, const unsigned __int64 Mantissa, const int Exponent);
static TSingleRec __fastcall _op_Explicit(Extended a);
union
{
struct
{
System::StaticArray<Byte, 4> Bytes;
};
struct
{
System::StaticArray<Word, 2> Words;
};
};
};

Inhaltsverzeichnis

Eigenschaften

Typ Sichtbarkeit Quelle Unit Übergeordnet
struct
class
public
System.pas
System.hpp
System System

Beschreibung

Stellt die Unterstützung zur Bearbeitung von Gleitkommawerten mit einfacher Genauigkeit bereit.

Mit TSingleRec können Low-Level-Operationen mit Gleitkommawerten mit einfacher Genauigkeit durchgeführt werden.

Beispiel

 
 var
   F: TSingleRec;
   I: Integer;
 
 begin
   F := TSingleRec(-0.5);
 
   // display the hexadecimal representation of the single precision floating-point value
   // leftmost bytes are the most significant
   for I := High(F.Bytes) downto Low(F.Bytes) do
     Write(IntToHex(F.Bytes[I], 2) + ' ');
   Writeln;
 
   // display the value contained in the TSingleRec record
   Writeln(FloatToStr(Single(F)));
 
   // ...

Konsolenausgabe:

BF 00 00 00
-0.5

Siehe auch

Frühere Versionen
Übersetzungen