| 12345678910111213141516171819202122232425262728293031323334 |
- program t92_strreal;
- { t92 -- Str(real:width:decimals, S). CALC.INC's Print calls
- Str(Value:FW:DEC,P)
- where Value is a REAL field, FW and DEC are integer fields/variables, and
- P is a string. The runtime's real_fmt already produces the padded,
- length-prefixed field; this fixture pins the compiler's argument packing
- and both widths/decimals. The outputs are derived from real_fmt's
- measured behaviour (the same rules as t84_realwrite): field width 8 with
- 2 decimals is ' 3.00'; width 0 is '3.00'; width 10 with 0 decimals
- pads 3 to ten columns. }
- type
- RealRec = record
- R : real;
- end;
- var
- X : RealRec;
- S : string[20];
- W, D : integer;
- begin
- X.R := 3;
- W := 8;
- D := 2;
- Str (X.R : W : D, S);
- writeln (S);
- Str (X.R : 0 : 2, S);
- writeln (S);
- Str (X.R : 10 : 0, S);
- writeln (S)
- end.
|