Am 03.10.2018 um 11:28 schrieb mailingli...@geldenhuys.co.uk: > > graeme.geldenhuys@UKCM-L500737 C:\devel\tests\OperatorPrecedence >> fpc -Criot TestOperatorPrecedence.pas > Free Pascal Compiler version 3.0.2 [2017/02/13] for i386 > Copyright (c) 1993-2017 by Florian Klaempfl and others > Target OS: Win32 for i386 > Compiling TestOperatorPrecedence.pas > TestOperatorPrecedence.pas(10,3) Note: Local variable "a" is assigned but > never used > Linking TestOperatorPrecedence.exe > 36 lines compiled, 0.1 sec, 35232 bytes code, 2436 bytes data > 1 note(s) issued > > graeme.geldenhuys@UKCM-L500737 C:\devel\tests\OperatorPrecedence >> TestOperatorPrecedence.exe > 5.1009900000000001E+004 > 5.1009900000000001E+004 > 5.1009900000000001E+004 > --- > -3.5527136788005009E-015 > -3.5527136788005009E-015 > -3.5527136788005009E-015 > 0.0000000000000000E+000 > 0.0000000000000000E+000 > > > Sorry, but this makes no sense to me.
In 32 Bit by default the x87 CPU is used. The x87 FPU uses extended for calculations and intermediate results (this is basically a difference with respect to all other FPUs having any significance during the last >20 years) by default. There are no instructions to force operations with single/double precisions, there is only a status which allows to switch to another precision, see below. b * c / d calculated with extended precision differs from the plain double value of c. To get the same results with the x87 FPU, add uses math; ...... SetPrecisionMode(pmDouble); to your program. Or: change all variables to extended, so the constants are really stored with extended precision representing exactly the value 51009.9. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal