[fpc-devel] Question about Currency support

Fuxin Zhang zhangfx at lemote.com
Tue Jun 5 02:47:39 CEST 2012


> In general, the type using which Pascal expressions are evaluated is
> completely independently from how the result is used afterwards.
>
> Currency is a special case because of all the scaling going on though.
> In addition to the resultdef, there's also the nf_is_currency node
> flag to determine whether or not the value still has to be scaled.
>
>>   But for the typeconvnode, what is the result/left/right node?
>
> There is no right node in a typeconvnode, only a left node
> (ttypeconvnode inherits from tunarynode, not from binary node). Left
> is whatever you are converting from, and resultdef (once it has been
> set from ttypeconvnode.totypedef) is what you are converting to.
>
I see now.

another question, after switch to int64_to_floatxx, the code should be
correct, but there is another issue that can be reduced to:
  i : currency;
  i := 9.99;
  frac(i) <> frac(9.99)

frac(i) will be 9.89999999999998E-001

tests/test/cg/taddcurr.pp still fail with this.

in gdb,
  (gdb) p 9.99 * 10000.0 / 10000.0
$1 = 9.9899999999999967

Is it the test program taddcurr.pp cannot work for non-x86 systems?
>
> Jonas
>





More information about the fpc-devel mailing list