Depending on your OS and CPU (bitness?) the code used to calculate log2 may differ and so might the result type.

On win32 the result type will be extended, on win64 it will be double.

Since on all systems the calculation involves floating point operations there will in most cases not be a mathematically correct return value, since most numbers cannot be represented exactly in a floating point.

So, while mathematically the result of Log2(8) equals 3 exactly, the actual result returned by the CPU might either be 2.99999999999999999999999 or 3.000000000000000000000001 or similar.

Compiled for win32 (i386 procesor) Log2(8) returns: 3.00000000000000000000E+0000, the return value being of type exyended,

Compiled for win64 (x86_64 processor) Log2(8) returns: 2.9999999999999996E+000, the return value of being type double.

i386 has dedicated asm function for Log2, x86_64 does not (in fpc 3.2.0), it calculates it as log2:=ln(x)*1.4426950408889634079; { 1/ln(2) }

Trunc() then returns the expected result: 2 in case of 2.999999999999999, 3 in case of 3.000000000000000001.

Bart