The expression you're printing evaluates to something slightly less than 27 due to the usual floating-point errors. The computer cannot exactly represent the natural logarithm of 3, so any further calculations based on it will have errors, too.
In comments, you claim exp(3*ln(3)) = 27.000, but you've shown no programmatic evidence for that assertion. Your code says exp(3*ln(3)) = 27, which is less precise. It prints that because you explicitly told WriteLn
to use less precision. The :0:0
part isn't just decoration. It means that you want to print the result with zero decimal places. When you tell WriteLn
to do that, it rounds to that many decimal places. In this case, it rounds up. But when you introduce the call to Int
, you truncate the almost-27 value to exactly 26, and then WriteLn
trivially rounds that to 26 before printing it.
If you tell WriteLn
to display more decimal places, you should see different results. Consult the documentation for Write
for details on what the numbers after the colons mean.