* fix trealconstnode.dogetcopy and trealconstnode.docompare, taking care of all fields, resolves #23486

git-svn-id: trunk@23241 -
This commit is contained in:
florian 2012-12-28 14:16:09 +00:00
parent e240856e43
commit f6b78719bc
3 changed files with 30 additions and 4 deletions

1
.gitattributes vendored
View File

@ -13085,6 +13085,7 @@ tests/webtbs/tw2332.pp svneol=native#text/plain
tests/webtbs/tw23342.pp svneol=native#text/pascal
tests/webtbs/tw23436.pp svneol=native#text/plain
tests/webtbs/tw23447.pp svneol=native#text/pascal
tests/webtbs/tw23486.pp svneol=native#text/pascal
tests/webtbs/tw23503.pp svneol=native#text/pascal
tests/webtbs/tw2351.pp svneol=native#text/plain
tests/webtbs/tw2363.pp svneol=native#text/plain

View File

@ -572,6 +572,7 @@ implementation
n : trealconstnode;
begin
n:=trealconstnode(inherited dogetcopy);
n.typedef:=typedef;
n.value_real:=value_real;
n.value_currency:=value_currency;
n.lab_real:=lab_real;
@ -596,10 +597,23 @@ implementation
begin
docompare :=
inherited docompare(p) and
(value_real = trealconstnode(p).value_real) and
{ floating point compares for non-numbers give strange results usually }
is_number_float(value_real) and
is_number_float(trealconstnode(p).value_real);
{ this should be always true }
(trealconstnode(p).typedef.typ=floatdef) and (typedef.typ=floatdef) and
(tfloatdef(typedef).floattype = tfloatdef(trealconstnode(p).typedef).floattype) and
(
(
(tfloatdef(typedef).floattype=s64currency) and
(value_currency=trealconstnode(p).value_currency)
)
or
(
(tfloatdef(typedef).floattype<>s64currency) and
(value_real = trealconstnode(p).value_real) and
{ floating point compares for non-numbers give strange results usually }
is_number_float(value_real) and
is_number_float(trealconstnode(p).value_real)
)
);
end;

11
tests/webtbs/tw23486.pp Normal file
View File

@ -0,0 +1,11 @@
{ %OPT=-O3 -Oocse }
program project1;
var
S: Single;
I: Integer;
begin
S := 400;
I := 600;
writeln(Round((I / 2) - (S / 2)));
end.