mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 23:01:55 +02:00
* more currency fixes, taddcurr runs now successfull
This commit is contained in:
parent
8351bb059b
commit
acb449fb1f
@ -181,7 +181,7 @@ implementation
|
|||||||
floattype for results }
|
floattype for results }
|
||||||
if (right.resulttype.def.deftype=floatdef) and
|
if (right.resulttype.def.deftype=floatdef) and
|
||||||
(left.resulttype.def.deftype=floatdef) and
|
(left.resulttype.def.deftype=floatdef) and
|
||||||
(tfloatdef(right.resulttype.def).typ=tfloatdef(right.resulttype.def).typ) then
|
(tfloatdef(left.resulttype.def).typ=tfloatdef(right.resulttype.def).typ) then
|
||||||
resultrealtype:=left.resulttype
|
resultrealtype:=left.resulttype
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -1224,6 +1224,29 @@ implementation
|
|||||||
resulttype:=left.resulttype;
|
resulttype:=left.resulttype;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ when the result is currency we need some extra code for
|
||||||
|
multiplication and division. this should not be done when
|
||||||
|
the muln or slashn node is created internally }
|
||||||
|
if not(nf_explizit in flags) and
|
||||||
|
is_currency(resulttype.def) then
|
||||||
|
begin
|
||||||
|
case nodetype of
|
||||||
|
slashn :
|
||||||
|
begin
|
||||||
|
hp:=caddnode.create(muln,getcopy,crealconstnode.create(10000.0,resultrealtype));
|
||||||
|
include(hp.flags,nf_explizit);
|
||||||
|
result:=hp;
|
||||||
|
end;
|
||||||
|
muln :
|
||||||
|
begin
|
||||||
|
hp:=caddnode.create(slashn,getcopy,crealconstnode.create(10000.0,resultrealtype));
|
||||||
|
include(hp.flags,nf_explizit);
|
||||||
|
result:=hp
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1892,7 +1915,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.74 2002-11-27 11:28:40 peter
|
Revision 1.75 2002-11-27 13:11:38 peter
|
||||||
|
* more currency fixes, taddcurr runs now successfull
|
||||||
|
|
||||||
|
Revision 1.74 2002/11/27 11:28:40 peter
|
||||||
* when both flaottypes are the same then handle the addnode using
|
* when both flaottypes are the same then handle the addnode using
|
||||||
that floattype instead of bestrealtype
|
that floattype instead of bestrealtype
|
||||||
|
|
||||||
|
@ -771,13 +771,28 @@ implementation
|
|||||||
|
|
||||||
var
|
var
|
||||||
t : trealconstnode;
|
t : trealconstnode;
|
||||||
|
rv : bestreal;
|
||||||
begin
|
begin
|
||||||
result:=nil;
|
result:=nil;
|
||||||
if left.nodetype=ordconstn then
|
if left.nodetype=ordconstn then
|
||||||
begin
|
begin
|
||||||
t:=crealconstnode.create(tordconstnode(left).value,resulttype);
|
rv:=tordconstnode(left).value;
|
||||||
|
if is_currency(resulttype.def) then
|
||||||
|
rv:=rv*10000.0;
|
||||||
|
t:=crealconstnode.create(rv,resulttype);
|
||||||
result:=t;
|
result:=t;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
{ multiply by 10000 for currency. We need to use getcopy to pass
|
||||||
|
the argument because the current node is always disposed. Only
|
||||||
|
inserting the multiply in the left node is not possible because
|
||||||
|
it'll get in an infinite loop to convert int->currency }
|
||||||
|
if is_currency(resulttype.def) then
|
||||||
|
begin
|
||||||
|
result:=caddnode.create(muln,getcopy,crealconstnode.create(10000.0,resulttype));
|
||||||
|
include(result.flags,nf_explizit);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -792,12 +807,14 @@ implementation
|
|||||||
if is_currency(left.resulttype.def) and not(is_currency(resulttype.def)) then
|
if is_currency(left.resulttype.def) and not(is_currency(resulttype.def)) then
|
||||||
begin
|
begin
|
||||||
left:=caddnode.create(slashn,left,crealconstnode.create(10000.0,left.resulttype));
|
left:=caddnode.create(slashn,left,crealconstnode.create(10000.0,left.resulttype));
|
||||||
|
include(left.flags,nf_explizit);
|
||||||
resulttypepass(left);
|
resulttypepass(left);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if is_currency(resulttype.def) and not(is_currency(left.resulttype.def)) then
|
if is_currency(resulttype.def) and not(is_currency(left.resulttype.def)) then
|
||||||
begin
|
begin
|
||||||
left:=caddnode.create(muln,left,crealconstnode.create(10000.0,left.resulttype));
|
left:=caddnode.create(muln,left,crealconstnode.create(10000.0,left.resulttype));
|
||||||
|
include(left.flags,nf_explizit);
|
||||||
resulttypepass(left);
|
resulttypepass(left);
|
||||||
end;
|
end;
|
||||||
if left.nodetype=realconstn then
|
if left.nodetype=realconstn then
|
||||||
@ -1975,7 +1992,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.90 2002-11-27 11:29:21 peter
|
Revision 1.91 2002-11-27 13:11:38 peter
|
||||||
|
* more currency fixes, taddcurr runs now successfull
|
||||||
|
|
||||||
|
Revision 1.90 2002/11/27 11:29:21 peter
|
||||||
* when converting from and to currency divide or multiple the
|
* when converting from and to currency divide or multiple the
|
||||||
result by 10000
|
result by 10000
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user