program ideone;
uses SysUtils;
const
    FloatFmt10:String = '0.##########';
    FloatFmt25:String = '0.#########################';
    FloatNum:String = '***'; //тут символи замість яких буде виводитись число
function VarToString(format: string; const a: array of extended): string;
var i, j: integer;
 s: string;
 x: extended;
begin
   s:=format;
   for i := Low(a) to High(a) do
   begin
     j := Pos(FloatNum, s);
     Delete(s, j, Length(FloatNum));
     x := a[i];
     if x>1e18 then
       Insert(FloatToStrF(x, ffFixed, 50, 0), s, j)
     else
       if x<1e-10 then
         Insert(FormatFloat(FloatFmt25, x), s, j)
       else
         Insert(FormatFloat(FloatFmt10, x), s, j)
   end;

   VarToString:=s;
end;

begin
	(* your code goes here *)
	writeln(VarToString('***',2e23));
	writeln(VarToString('***',2e50));
end.