mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 20:19:34 +01:00
* fix trealconstnode.dogetcopy and trealconstnode.docompare, taking care of all fields, resolves #23486
git-svn-id: trunk@23241 -
This commit is contained in:
parent
e240856e43
commit
f6b78719bc
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
||||
@ -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
11
tests/webtbs/tw23486.pp
Normal 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.
|
||||
Loading…
Reference in New Issue
Block a user