Reputation: 299
I have a double type big number, say 1111111111111110000000000000.000.
How to format it to string for display in Delphi?
I've tried FloatToStr
and FormatFloat
, but I receive the Scientific Notation which is not what I want.
Upvotes: 1
Views: 2345
Reputation: 34899
Using the System.Str conversion works:
var
d: Double;
s: String;
begin
d := 1111111111111110000000000000.000;
Str(d:0:3,s);
WriteLn(s);
end;
Outputs: 1111111111111109950000000000.000
Note: double precision has not the precision to exactly hold the digits you are trying to input.
Normally in that case you would not show all digits, since this can give the impression that they all are accurate. This is why the scientific notation is prefered.
Upvotes: 3