* 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:
florian 2011-04-10 19:40:18 +00:00
parent c97869bd89
commit ff6ab60508
3 changed files with 16 additions and 1 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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
View 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.