Hi,
When I run this on Win32 (FPC 2.6.4):
==============================================
var
    c: currency;
    e: integer;
begin
  c:=0;
  Val('-922337203685477.5808',c,e);
  Writeln('c=',c,' , e=',e);
  Writeln(StrToCurr('-922337203685477,5808'));
end.
==============================================

 I get "correct" results:
-------------------------------------------------------------------------
c=-9.223372036854775808E+14 , e=0
-9.223372036854775808E+14
-------------------------------------------------------------------------

But when I recompile for Win64 I get:
-------------------------------------------------------------------------
c= 0.000000000000000000E+00 , e=22
An unhandled exception occurred at $000000000042B180 :
EConvertError : "-922337203685477,5808" is an invalid float
-------------------------------------------------------------------------

As per documentation: http://www.freepascal.org/docs-html/ref/refsu6.html
-922337203685477.5808 is in range of Currency data type
But in sysstrh.inc is conditional definition of MinCurrency, but none is -922337203685477.5808

What is right behavior ?
Thanks
-Laco.


There is also related bug report: http://bugs.freepascal.org/view.php?id=28737

And look at part of code in rtl/objpas/sysutils/sysstrh.inc:

41 {$if defined(FPC_HAS_TYPE_EXTENDED) or defined(FPC_HAS_TYPE_FLOAT128)}
42       MinCurrency: Currency = -922337203685477.5807;
43       MaxCurrency: Currency =  922337203685477.5807;
44     {$else}
45       MinCurrency: Currency = -922337203685477.0000;
46       MaxCurrency: Currency =  922337203685477.0000;
47     {$endif}

Why is for case not defined(FPC_HAS_TYPE_EXTENDED), MinCurrency defined as is ?

-Laco.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to