On Sun, 11 Sep 2011, Henrique Andrade wrote:
Today I've found a very strange problem on Gretl. Please take a
look at the
following *hansl* code:
OK, but could you please send mail in plain text? This is
particularly important when trying to convey hansl code. I have
edited what you posted to make the following intelligible.
<hansl>
open hamilton.gdt
series x = PC6IT
series y = PZUNEW
series z = EXRITL
series teste = ((x[1989:01]/y[1989:01]) * z)/z * 100
diff teste
gnuplot teste d_teste --time-series --with-lines --output=display
</hansl>
I think that mathematically the "teste" expression is a constant.
So, the first difference of a constant variable is equal to zero.
Welcome to digital computer arithmetic! Floating-point numbers are
represented to finite precision (64 bits, generally, within gretl
and most econometrics software). If you multiply x by z and then
divide the product by z, you do not necessarily get exactly the
original x as the answer.
Your "constant" series is not constant so far as the computer is
concerned: some values differ from the previous one by plus-or-minus
a figure on the order of 10^{-14}. To see this, add above:
<hansl>
print z teste d_teste --byobs
</hansl>
Allin Cottrell