ventiseis
ventiseis

Reputation: 3099

How to format MinExtended80Denormal?

The unit System.Math defines the constant

MinExtended80Denormal

Can I convert this number to string with the given rtl functions?

I tried

FormatFloat('#.##############E+####', System.math.MinExtended80Denormal)

which results in

000000000000000E+00000

I tried larger denormalized values too, but it seems that such values (in which the exponent is zero) are not supported by the built-in formatting functions.

Upvotes: 3

Views: 145

Answers (1)

LU RD
LU RD

Reputation: 34899

Using the System built in printing functions it works:

uses
  Math;
var
  s:String;
begin
  Str(MinExtended80Denormal,s);
  WriteLn(s);
  WriteLn(MinExtended80Denormal);
  Str(MinExtended80Denormal:26:-1,s);
  WriteLn(s);
  WriteLn(MinExtended80Denormal:26:-1);
end.

Outputs:

3.64519953188247E-4951
3.64519953188247E-4951
3.64519953188247460E-4951
3.64519953188247460E-4951

The constant MinExtended80Denormal is defined as: 3.64519953188247460253e-4951 So the best result gives all digits but the last three decimals.


I also tried WriteLn(MinExtended80Denormal.ToString), but that gave 0.

Upvotes: 4

Related Questions