It is strange that linux64 and win64 differ. Of course the extended type is not the most ideal type to test, specially if you include 64-bit
No, it's not. Win64 is the
only x86_64 target where Extended is not available. The other targets have not deprecated the FPU and thus FPC is happily using it for calculations.
The code tries to output a rounded float, and the output are given in the block comment. As seen, FloatToStrF and Format are inconsistent within FPC, and inconsistent with Delphi under Win32 and Lnx64. Could you help to comment how to make FloatToStrF and Format consistent within FPC (and with Delphi) ?
The difference between the FPC targets is that Extended is not available on x86_64-win64, while it is available for the other x86_64 targets as well as all i386 targets (plus i8086, but that's probably neither here nor there for you
). It's also not supported on any other platform we have (e.g. ARM, PowerPC, etc.).
So your best bet would be to stick with Double if you want to be cross platform.
Why Delphi differs to FPC I don't know though it could be (as only the final digit differs) that FPC rounds a tad different than Delphi.
With that redundant line commented out, nothing will be written.
{$IFOPT D+} is enough. That's the point. DEBUG is predefined for the compiler. E.g:
begin
{$IFOPT D+} // is the same as { $IFDEF DEBUG} you dont't need to mix them like you did.
Writeln('Hello World');
{$ENDIF}
end.
You are not entirely correct. The
D option or
DebugInfo is only enabled (outside of using
$D+ or
$DebugInfo On) when the parameter
-g is passed (see
here).
However by default the
fpc.cfg file contains this:
#IFDEF DEBUG
-gl
-Crtoi
#WRITE Compiling Debug Version
#ENDIF
So it's in fact like this: if you compile with
-dDEBUG then
-g will be set and thus the
D option will be as well.