mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 12:49:09 +02:00
* prefer typecast currency->extended over currency->single/double because the former loses no precision while the latter might cause a loss of precision, resolves #19077
git-svn-id: trunk@17297 -
This commit is contained in:
parent
c97869bd89
commit
ff6ab60508
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -11282,6 +11282,7 @@ tests/webtbs/tw1896.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1901.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1902.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1907.pp svneol=native#text/plain
|
||||
tests/webtbs/tw19077.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw1908.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1909.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1910.pp svneol=native#text/plain
|
||||
|
@ -564,7 +564,8 @@ implementation
|
||||
begin
|
||||
doconv:=tc_real_2_real;
|
||||
{ do we lose precision? }
|
||||
if def_to.size<def_from.size then
|
||||
if (def_to.size<def_from.size) or
|
||||
(is_currency(def_from) and (tfloatdef(def_to).floattype in [s32real,s64real])) then
|
||||
eq:=te_convert_l2
|
||||
else
|
||||
eq:=te_convert_l1;
|
||||
|
13
tests/webtbs/tw19077.pp
Normal file
13
tests/webtbs/tw19077.pp
Normal file
@ -0,0 +1,13 @@
|
||||
uses
|
||||
math;
|
||||
var
|
||||
c : currency;
|
||||
begin
|
||||
c:=1.5625;
|
||||
c:=RoundTo(c,-1);
|
||||
if c<>1.6 then
|
||||
halt(1);
|
||||
writeln('ok');
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user