Skip to content

TSingleHelper

Helper for Single floating point type.

Declaration

Source position: syshelph.inc line 669

type

  TSingleHelper = type helper for Single
  public
    const
      Epsilon : Single = 1.4012984643248170709e-45;
      MachineEpsilon : Single = 1.1920928955078125e-7;
      MaxValue : Single = 340282346638528859811704183484516925440.0;
      MinValue : Single = - 340282346638528859811704183484516925440.0;
      PositiveInfinity : Single = 1.0 / 0.0;
      NegativeInfinity : Single = (- 1.0) / (0.0);
      NaN : Single = 0.0 / 0.0;
    class function IsNan(const AValue: Single) : Boolean; overload;
    function IsNan : Boolean; overload;
    class function IsInfinity(const AValue: Single) : Boolean; overload;
    function IsInfinity : Boolean; overload;
    class function IsNegativeInfinity(const AValue: Single) : Boolean; overload;
    function IsNegativeInfinity : Boolean; overload;
    class function IsPositiveInfinity(const AValue: Single) : Boolean; overload;
    function IsPositiveInfinity : Boolean; overload;
    class function Parse(const AString: string) : Single; overload;
    class function Parse(const AString: string; 
                    const AFormatSettings: TFormatSettings) : Single; overload;
    class function Size : Integer;
    class function ToString(const AValue: Single) : string; overload;
    class function ToString(const AValue: Single; 
                       const AFormatSettings: TFormatSettings) : string; overload;
    class function ToString(const AValue: Single; 
                       const AFormat: TFloatFormat; 
                       const APrecision: Integer; 
                       const ADigits: Integer) : string; overload;
    class function ToString(const AValue: Single; 
                       const AFormat: TFloatFormat; 
                       const APrecision: Integer; 
                       const ADigits: Integer; 
                       const AFormatSettings: TFormatSettings) : string; overload;
    function ToString(const AFormat: TFloatFormat; 
                 const APrecision: Integer; const ADigits: Integer)
                  : string; overload;
    function ToString(const AFormat: TFloatFormat; 
                 const APrecision: Integer; const ADigits: Integer; 
                 const AFormatSettings: TFormatSettings) : string; overload;
    function ToString(const AFormatSettings: TFormatSettings) : string; overload;
    function ToString : string; overload;
    class function TryParse(const AString: string; out AValue: Single)
                        : Boolean; overload;
    class function TryParse(const AString: string; out AValue: Single; 
                       const AFormatSettings: TFormatSettings) : Boolean; overload;
    procedure BuildUp;
    function Exponent : Integer;
    function Fraction : Extended;
    function Mantissa : QWord;
    function SpecialType : TFloatSpecial;
    property Bytes[AIndex : Cardinal]: Byte; {rw}
    property Words[AIndex : Cardinal]: Word; {rw}
    property Sign: Boolean; {rw}
    property Exp: QWord; {rw}
    property Frac: QWord; {rw}
  end;

Inheritance

Description

TSingleHelper is the helper type for the single-sized floating point type. It contains some conversion methods, as well as access to the low-level structure of the floating-point representation of a single.

Properties

Member Visibility Description
Bytes public Indexed access to the individual bytes of the floating point value.
Exp public The bit pattern of the exponent as stored in memory.
Frac public Bitpattern that makes up the fractional part.
Sign public Sign of the floating point value.
Words public Indexed access to the words that make up the floating point value.

Methods

Member Visibility Description
BuildUp public Build a single-sized floating point from its composing parts.
Exponent public Exponent of the floating-point value.
Fraction public Fraction of the floating-point value.
IsInfinity public Check whether a value is positive or negative infinity.
IsNan public Check whether a value equals NaN.
IsNegativeInfinity public Check whether a value is negative infinity.
IsPositiveInfinity public Check whether a value is positive infinity.
Mantissa public Mantissa of the floating-point.
Parse public Convert a string to a floating point value.
Size public Size (in bytes) of a single-sized floating point value.
SpecialType public Return the type of the single-sized floating point value.
ToString public Convert a single-sized floating point value to a string.
TryParse public Try to convert a string to a single-sized floating point value.

See also

Name Description
TDoubleHelper Helper for Double floating point type.
TExtendedHelper Helper for Extended floating point type.