System.TDoubleRec

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

  TDoubleRec = packed record
  private
    aDouble: Double;
    function InternalGetBytes(Index: Cardinal): UInt8; inline;
    function InternalGetWords(Index: Cardinal): UInt16; inline;
    procedure InternalSetBytes(Index: Cardinal; const Value: UInt8); inline;
    procedure InternalSetWords(Index: Cardinal; const Value: UInt16); inline;
    function GetBytes(Index: Cardinal): UInt8; inline;
    function GetWords(Index: Cardinal): UInt16; inline;
    procedure SetBytes(Index: Cardinal; const Value: UInt8); inline;
    procedure SetWords(Index: Cardinal; const Value: UInt16); inline;
    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): TDoubleRec; inline;
    class operator Explicit(a: TDoubleRec): Extended; inline;
    property Bytes[Index: Cardinal]: UInt8 read GetBytes write SetBytes;  // 0..7
    property Words[Index: Cardinal]: UInt16 read GetWords write SetWords; // 0..3
  end deprecated 'Use TDoubleHelper';

C++

struct DECLSPEC_DRECORD TDoubleRec
{
private:
    double aDouble;
    Byte __fastcall InternalGetBytes(unsigned Index);
    Word __fastcall InternalGetWords(unsigned Index);
    void __fastcall InternalSetBytes(unsigned Index, const Byte Value);
    void __fastcall InternalSetWords(unsigned Index, const Word Value);
    Byte __fastcall GetBytes(unsigned Index);
    Word __fastcall GetWords(unsigned Index);
    void __fastcall SetBytes(unsigned Index, const Byte Value);
    void __fastcall SetWords(unsigned Index, const Word Value);
    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 TDoubleRec __fastcall _op_Explicit(Extended a);
    __property Byte Bytes[unsigned Index] = {read=GetBytes, write=SetBytes};
    __property Word Words[unsigned Index] = {read=GetWords, write=SetWords};
};

Propriétés

Type Visibilité  Source Unité  Parent
record
struct
public
System.pas
System.hpp
System System


Description

Avertissement : TDoubleRec est obsolète. Veuillez utiliser SysUtils.TDoubleHelper.

Fournit la prise en charge pour la manipulation des valeurs à virgule flottante en double précision.

Un TDoubleRec peut être utilisé pour effectuer des opérations de bas niveau sur une valeur à virgule flottante en double précision. Par exemple, le signe, l'exposant et la mantisse peuvent être changés séparément.

Remarque :

  • Pour manipuler un type de données à virgule flottante en double précision, il est recommandé d'utiliser TDoubleHelper. Toutefois, TDoubleRec n'est pas obsolète, et vous pouvez utiliser TDoubleRec pour allouer des données à virgule flottante en double précision.
  • Depuis XE3, les propriétés TDoubleRec.Bytes et TDoubleRec.Words sont des propriétés tableau. Les opérateurs System.High et System.Low ne s'appliquent pas aux propriétés tableau. Vous pouvez utiliser à la place System.SizeOf, comme illustré dans l'exemple de TSingleRec.

Voir aussi