[fpc-devel] Default-max-precision for different float types?

Michael Van Canneyt michael at freepascal.org
Tue Feb 13 11:07:47 CET 2024



On Tue, 13 Feb 2024, Martin Frb via fpc-devel wrote:

> https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40768
>
> Are there any defaults, with which precision each float type 
> (single/double/extended) should be printed?

Sysutils contains some defaults used by the format function:

  case ValueType of
     fvExtended:
       Str(Extended(Value):25, Buffer);
     fvDouble,
     fvReal:
       Str(Double(Value):23, Buffer);
     fvSingle:
       Str(Single(Value):16, Buffer);
     fvCurrency:
       Str(Currency(Value):25, Buffer);
     fvComp:
       Str(Currency(Value):23, Buffer);
   end;


There are probably some other constants in the flt_core.inc file in the rtl
for the write/str functions...

Michael.


More information about the fpc-devel mailing list