mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-06 16:36:07 +02:00
* even if currency is handled by torddef, it is a real number, so using / is perfectly right, resolves #38718
git-svn-id: trunk@49154 -
This commit is contained in:
parent
243ddea686
commit
09628e56cb
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -18775,6 +18775,7 @@ tests/webtbs/tw3865.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw38695.pp svneol=native#text/pascal
|
tests/webtbs/tw38695.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3870.pp svneol=native#text/plain
|
tests/webtbs/tw3870.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw38703.pp svneol=native#text/pascal
|
tests/webtbs/tw38703.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw38718.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw38733.pp svneol=native#text/pascal
|
tests/webtbs/tw38733.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3893.pp svneol=native#text/plain
|
tests/webtbs/tw3893.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3898.pp svneol=native#text/plain
|
tests/webtbs/tw3898.pp svneol=native#text/plain
|
||||||
|
@ -942,7 +942,7 @@ implementation
|
|||||||
{An attempt to convert the result of a floating point division
|
{An attempt to convert the result of a floating point division
|
||||||
(with the / operator) to an integer type will fail. Give a hint
|
(with the / operator) to an integer type will fail. Give a hint
|
||||||
to use the div operator.}
|
to use the div operator.}
|
||||||
if (node.nodetype=slashn) and (def.typ=orddef) then
|
if (node.nodetype=slashn) and (def.typ=orddef) and not(is_currency(def)) then
|
||||||
cgmessage(type_h_use_div_for_int);
|
cgmessage(type_h_use_div_for_int);
|
||||||
{In expressions like int64:=longint+longint, an integer overflow could be avoided
|
{In expressions like int64:=longint+longint, an integer overflow could be avoided
|
||||||
by simply converting the operands to int64 first. Give a hint to do this.}
|
by simply converting the operands to int64 first. Give a hint to do this.}
|
||||||
|
12
tests/webtbs/tw38718.pp
Normal file
12
tests/webtbs/tw38718.pp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{ %opt=-vh -Seh }
|
||||||
|
program CurrencyTest;
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
var
|
||||||
|
C: Currency;
|
||||||
|
D: Integer;
|
||||||
|
begin
|
||||||
|
C := 1234.56;
|
||||||
|
D := 2;
|
||||||
|
C := C / D; // Hint: Use DIV instead to get an integer result
|
||||||
|
Writeln(C);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user