Browse Source

* properly set types for currency divisions, resolves #38717

florian 3 years ago
parent
commit
34630c2ef9
2 changed files with 16 additions and 1 deletions
  1. 1 1
      compiler/nmat.pas
  2. 15 0
      tests/webtbs/tw38717.pp

+ 1 - 1
compiler/nmat.pas

@@ -511,7 +511,7 @@ implementation
 
 
         { when currency is used set the result of the
         { when currency is used set the result of the
           parameters to s64bit, so they are not converted }
           parameters to s64bit, so they are not converted }
-        if is_currency(resultdef) then
+        if nf_is_currency in flags then
           begin
           begin
             left.resultdef:=s64inttype;
             left.resultdef:=s64inttype;
             right.resultdef:=s64inttype;
             right.resultdef:=s64inttype;

+ 15 - 0
tests/webtbs/tw38717.pp

@@ -0,0 +1,15 @@
+program CurrencyTest;
+
+{$mode objfpc}{$H+}
+
+var
+  C: Currency;
+  R, D: Currency;
+begin
+  C := 1234.56;
+  R := 4;
+  D := 2;
+  C := C * R / D;
+  Writeln(C);
+end.
+