mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-05 17:30:49 +02:00
+ support for the directive $EXCESSPRECISION
git-svn-id: trunk@39443 -
This commit is contained in:
parent
3e2be29030
commit
0c6cf12fbf
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -462,7 +462,7 @@ compiler/msg/errorru.msg svneol=native#text/plain
|
|||||||
compiler/msg/errorues.msg svneol=native#text/plain
|
compiler/msg/errorues.msg svneol=native#text/plain
|
||||||
compiler/msgidx.inc svneol=native#text/plain
|
compiler/msgidx.inc svneol=native#text/plain
|
||||||
compiler/msgtxt.inc svneol=native#text/plain
|
compiler/msgtxt.inc svneol=native#text/plain
|
||||||
compiler/nadd.pas -text svneol=native#text/plain
|
compiler/nadd.pas svneol=native#text/plain
|
||||||
compiler/nbas.pas svneol=native#text/plain
|
compiler/nbas.pas svneol=native#text/plain
|
||||||
compiler/ncal.pas svneol=native#text/plain
|
compiler/ncal.pas svneol=native#text/plain
|
||||||
compiler/ncgadd.pas svneol=native#text/plain
|
compiler/ncgadd.pas svneol=native#text/plain
|
||||||
@ -11577,6 +11577,7 @@ tests/tbs/tb0645b.pp svneol=native#text/pascal
|
|||||||
tests/tbs/tb0645c.pp svneol=native#text/pascal
|
tests/tbs/tb0645c.pp svneol=native#text/pascal
|
||||||
tests/tbs/tb0646a.pp svneol=native#text/pascal
|
tests/tbs/tb0646a.pp svneol=native#text/pascal
|
||||||
tests/tbs/tb0646b.pp svneol=native#text/pascal
|
tests/tbs/tb0646b.pp svneol=native#text/pascal
|
||||||
|
tests/tbs/tb0648.pp svneol=native#text/pascal
|
||||||
tests/tbs/tb205.pp svneol=native#text/plain
|
tests/tbs/tb205.pp svneol=native#text/plain
|
||||||
tests/tbs/tb610.pp svneol=native#text/pascal
|
tests/tbs/tb610.pp svneol=native#text/pascal
|
||||||
tests/tbs/tb613.pp svneol=native#text/plain
|
tests/tbs/tb613.pp svneol=native#text/plain
|
||||||
|
@ -148,6 +148,7 @@ interface
|
|||||||
cs_full_boolean_eval,cs_typed_const_writable,cs_allow_enum_calc,
|
cs_full_boolean_eval,cs_typed_const_writable,cs_allow_enum_calc,
|
||||||
cs_do_inline,cs_fpu_fwait,cs_ieee_errors,
|
cs_do_inline,cs_fpu_fwait,cs_ieee_errors,
|
||||||
cs_check_low_addr_load,cs_imported_data,
|
cs_check_low_addr_load,cs_imported_data,
|
||||||
|
cs_excessprecision,
|
||||||
{ mmx }
|
{ mmx }
|
||||||
cs_mmx,cs_mmx_saturation,
|
cs_mmx,cs_mmx_saturation,
|
||||||
{ parser }
|
{ parser }
|
||||||
|
@ -157,7 +157,8 @@ implementation
|
|||||||
{ when a comp or currency is used, use always the
|
{ when a comp or currency is used, use always the
|
||||||
best float type to calculate the result }
|
best float type to calculate the result }
|
||||||
if (tfloatdef(t2).floattype in [s64comp,s64currency]) or
|
if (tfloatdef(t2).floattype in [s64comp,s64currency]) or
|
||||||
(tfloatdef(t2).floattype in [s64comp,s64currency]) then
|
(tfloatdef(t2).floattype in [s64comp,s64currency]) or
|
||||||
|
(cs_excessprecision in current_settings.localswitches) then
|
||||||
result:=pbestrealtype^
|
result:=pbestrealtype^
|
||||||
else
|
else
|
||||||
if floatweight[tfloatdef(t2).floattype]>floatweight[tfloatdef(t1).floattype] then
|
if floatweight[tfloatdef(t2).floattype]>floatweight[tfloatdef(t1).floattype] then
|
||||||
@ -1384,7 +1385,12 @@ implementation
|
|||||||
if (right.resultdef.typ=floatdef) and
|
if (right.resultdef.typ=floatdef) and
|
||||||
(left.resultdef.typ=floatdef) and
|
(left.resultdef.typ=floatdef) and
|
||||||
(tfloatdef(left.resultdef).floattype=tfloatdef(right.resultdef).floattype) then
|
(tfloatdef(left.resultdef).floattype=tfloatdef(right.resultdef).floattype) then
|
||||||
resultrealdef:=left.resultdef
|
begin
|
||||||
|
if cs_excessprecision in current_settings.localswitches then
|
||||||
|
resultrealdef:=pbestrealtype^
|
||||||
|
else
|
||||||
|
resultrealdef:=left.resultdef
|
||||||
|
end
|
||||||
{ when there is a currency type then use currency, but
|
{ when there is a currency type then use currency, but
|
||||||
only when currency is defined as float }
|
only when currency is defined as float }
|
||||||
else
|
else
|
||||||
|
@ -430,6 +430,12 @@ unit scandir;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure dir_excessprecision;
|
||||||
|
begin
|
||||||
|
do_localswitch(cs_excessprecision);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure dir_objectchecks;
|
procedure dir_objectchecks;
|
||||||
begin
|
begin
|
||||||
do_localswitch(cs_check_object);
|
do_localswitch(cs_check_object);
|
||||||
@ -1909,6 +1915,7 @@ unit scandir;
|
|||||||
AddDirective('ENDREGION',directive_all, @dir_endregion);
|
AddDirective('ENDREGION',directive_all, @dir_endregion);
|
||||||
AddDirective('ERROR',directive_all, @dir_error);
|
AddDirective('ERROR',directive_all, @dir_error);
|
||||||
AddDirective('ERRORC',directive_mac, @dir_error);
|
AddDirective('ERRORC',directive_mac, @dir_error);
|
||||||
|
AddDirective('EXCESSPRECISION',directive_all, @dir_excessprecision);
|
||||||
AddDirective('EXTENDEDSYNTAX',directive_all, @dir_extendedsyntax);
|
AddDirective('EXTENDEDSYNTAX',directive_all, @dir_extendedsyntax);
|
||||||
AddDirective('EXTERNALSYM',directive_all, @dir_externalsym);
|
AddDirective('EXTERNALSYM',directive_all, @dir_externalsym);
|
||||||
AddDirective('F',directive_all, @dir_forcefarcalls);
|
AddDirective('F',directive_all, @dir_forcefarcalls);
|
||||||
|
22
tests/tbs/tb0648.pp
Normal file
22
tests/tbs/tb0648.pp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{$excessprecision on}
|
||||||
|
const
|
||||||
|
d1: double = 1.0/3.0;
|
||||||
|
d2: double = 1/3;
|
||||||
|
x1: extended = 1.0/3.0;
|
||||||
|
x2: extended = 1/3;
|
||||||
|
s1: single = 1.0/3.0;
|
||||||
|
s2: single = 1/3;
|
||||||
|
begin
|
||||||
|
writeln(s1:30:10, s2:30:10);
|
||||||
|
if s1<>s2 then
|
||||||
|
halt(1);
|
||||||
|
writeln(d1:30:16, d2:30:16);
|
||||||
|
if d1<>d2 then
|
||||||
|
halt(1);
|
||||||
|
{$ifdef FPUX87}
|
||||||
|
writeln(x1:30:24, x2:30:24);
|
||||||
|
if x1<>x2 then
|
||||||
|
halt(1);
|
||||||
|
{$endif FPUX87}
|
||||||
|
writeln('ok');
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user