home *** CD-ROM | disk | FTP | other *** search
-
- #log 4-byte Single to Floating point conversion
-
- type
- single = array[0..3] of byte;
- double = array[0..7] of byte;
-
-
- function stof(B: single): real;
- {convert 4 byte single to real}
- var
- PasReal: real;
- PasArray: array [0 .. 5] of byte absolute PasReal;
- BasArray: array [0 .. 3] of byte absolute B;
- begin
- fillchar(PasArray[0],3,0);
- move(BasArray[0],PasArray[3],3);
- PasArray[0]:=BasArray[3];
- stof := PasReal;
- end;
-
-
- procedure ftos(PasReal: real; var B: single);
- {convert real to 4 byte single}
- var
- PasArray: array [0 .. 5] of byte absolute PasReal;
- BasArray: array [0 .. 3] of byte absolute B;
- begin
- move(PasArray[3],BasArray[0],3);
- BasArray[3]:=PasArray[0];
- end;
-
-
- function dtof(B: double): real;
- {convert 8 byte double to real}
- var
- PasReal: real;
- PasArray: array [0 .. 5] of byte absolute PasReal;
- BasArray: array [0 .. 7] of byte absolute B;
- begin
- fillchar(PasArray[0],3,0);
- move(BasArray[0],PasArray[3],3);
- PasArray[0]:=BasArray[3];
- PasReal := 0; {function not implemented}
- dtof := PasReal;
- end;
-
-
-