[fpc-pascal] Currency constant wrongly stored in generated EXE ? was: Re: Inconsistent results currency - extended ?

LacaK lacak at zoznam.sk
Wed May 7 08:18:03 CEST 2014


Bruno Krayenbuhl  wrote / napĂ­sal(a):
> I have absolutely no idea of how the compiler does translate Currency 
> constant to code, sorry.

>  
> May be it uses the FPU when translating from String representation to 
> assembler value, but I have absolutely no idea where that would be 
> done in the compiler.
>  
> Anyway, it may be possible that the compiler uses StrToCurr or 
> something similar.
>  
> var cAsString:string;
> .
> .
> cAsString:=CurrToStr(c);
> c:=StrToCurr(cAsString). { <== Check after here on W98 / XP and look 
> for differences on value c.  That uses an FPU instruction fistpll that 
> look as causing
For :
  c:=strtocurr('92233720368547');
  writeln(c); // here I get CORRECT result: 9.223372036854700000E+13

But as I wrote:
  c:=92233720368547;
  writeln(c);  // here I get INCORRECT result: 9.223372036854699520E+13

But as I wrote it is not a problem of displaying currency value, it is 
problem that currency variable realy contains incorrect number, which is 
then correctly displayed ... ;-(

-Laco.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140507/7d1386d8/attachment.html>


More information about the fpc-pascal mailing list