help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'System' (#rtl)

Real2Double

Convert Turbo Pascal style real to double.

Declaration

Source position: mathh.inc line 88

function Real2Double(

  r: real48

):double;

Description

The Real2Double function converts a Turbo Pascal style real (6 bytes long) to a native Free Pascal double type. It can be used e.g. to read old binary TP files with FPC and convert them to Free Pacal binary files.

Note that the assignment operator has been overloaded so a Real48 type can be assigned directly to a double or extended.

Errors

None.

Example

program Example110;

{ Program to demonstrate the Real2Double function. }

Var
  i : integer;
  R : Real48;
  D : Double;
  E : Extended;
  F : File of Real48;

begin
  Assign(F,'reals.dat');
  Reset(f);
  For I:=1 to 10 do
    begin
    Read(F,R);
    D:=Real2Double(R);
    Writeln('Real ',i,' : ',D);
    D:=R;
    Writeln('Real (direct to double)  ',i,' : ',D);
    E:=R;
    Writeln('Real (direct to Extended) ',i,' : ',E);
    end;
  Close(f);
end.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505