home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
d
/
drcpas10.zip
/
IEEE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-11-17
|
2KB
|
68 lines
{$A+,B-,D-,F-,L-,N+,O-,R-,S+,V-}
Unit IEEE;
(* by David R. Conrad, for Turbo Pascal 5.5
This code is not copyrighted, you may use it freely.
There are no guarantees, either expressed or implied,
as to either merchantability or fitness for a particular
purpose. The author's liability is limited to the amount
you paid for it.
David R. Conrad, 17 Nov 92
David_Conrad@mts.cc.wayne.edu
dave@michigan.com
*)
Interface
(* this unit contains the IEEE versions of the tools.pas routines:
Commarstr, NumrStr and ZerorStr
*)
Function CommaeStr (E : Extended; D : Byte) : String;
Function NumeStr (E : Extended; W,D : Byte) : String;
Function ZeroeStr (E : Extended; W,D : Byte) : String;
Implementation
Function CommaeStr (E : Extended; D : Byte) : String;
var
s,st : string;
len,alen,num,cnt : byte;
eh,et : extended;
begin
eh := Int(E);
et := Frac(E);
str (eh:0:0,s);
str (et:0:D,st);
delete (st,1,1);
len := length(s);
If E >= 0 then alen := pred(len) Else alen := pred(len) - 1;
num := alen DIV 3;
for cnt := 1 to num do
Insert (',',s,len - cnt * 3 + 1);
CommaeStr := s + st;
end;
Function NumeStr (E : Extended; W,D : Byte) : String;
var
s : string;
begin
str (E:W:D,s);
NumeStr := s;
end;
Function ZeroeStr (E : Extended; W,D : Byte) : String;
var
s : string;
cnt : byte;
begin
str (E:W:D,s);
for cnt := 1 to length(s) do
If s[cnt] = ' ' then s[cnt] := '0';
ZeroeStr := s;
end;
End.