The documentation seems clear to me.
In Free Pascal Programmer’s Guide:
https://downloads.freepascal.org/fpc/docs-pdf/prog.pdf$MINFPCONSTPREC is listed under
Local directives.
$POP and $PUSH says:
Global settings (search paths etc.) are not saved/restored by this directive.
If I replace {$MINFPCONSTPREC 64} with {$APPTYPE GUI} (a global one), I get the following message:
demo_fp_02.pas(23,25) Warning: Misplaced global compiler switch, ignoredHere is a simple test to check $POP:
{$MODE DELPHI}
program demoFP;
type TestValue = packed record
case byte of
0: (doubleRepresentation: double);
1: (UInt64Representation: uint64);
end;
var
tv: TestValue;
d: double;
begin
d := 1.0 / 3.0;
tv.doubleRepresentation := d;
writeln(' single / single :', tv.UInt64Representation);
d := Double(1.0) / Double(3.0);
tv.doubleRepresentation := d;
writeln('casted to double / casted to double :', tv.UInt64Representation);
{$IFDEF FPC}{$PUSH}{$MINFPCONSTPREC 64}{$ENDIF}
d := 1.0 / 3.0;
{$IFDEF FPC}{$POP}{$ENDIF}
tv.doubleRepresentation := d;
writeln(' double / double :', tv.UInt64Representation);
d := 1.0 / 3.0;
tv.doubleRepresentation := d;
writeln('Single type again: single / single :', tv.UInt64Representation);
end.
The results:
single / single :4599676419600023552
casted to double / casted to double :4599676419421066581
double / double :4599676419421066581
Single type again: single / single :4599676419421066581
Still double / double.
This gives back the single/single result:
{$MODE DELPHI}
program demoFP;
type TestValue = packed record
case byte of
0: (doubleRepresentation: double);
1: (UInt64Representation: uint64);
end;
var
tv: TestValue;
d: double;
begin
d := 1.0 / 3.0;
tv.doubleRepresentation := d;
writeln(' single / single :', tv.UInt64Representation);
d := Double(1.0) / Double(3.0);
tv.doubleRepresentation := d;
writeln('casted to double / casted to double :', tv.UInt64Representation);
{$MINFPCONSTPREC 64}
d := 1.0 / 3.0;
{$MINFPCONSTPREC DEFAULT}
tv.doubleRepresentation := d;
writeln(' double / double :', tv.UInt64Representation);
d := 1.0 / 3.0;
tv.doubleRepresentation := d;
writeln('Single type again: single / single :', tv.UInt64Representation);
end.
Some clarification needed in the documentation.
Thanks PascalDragon