Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2024-02

Default-max-precision for different float types?

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt
to Martin Frb
Martin Frb 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.

Reply by email