* fixed operator mod for floats as proposed by wp in #33167, resolves #33167

git-svn-id: trunk@38332 -
This commit is contained in:
florian 2018-02-24 18:23:06 +00:00
parent 3b779278e2
commit 8a2cf56d51
3 changed files with 25 additions and 0 deletions

1
.gitattributes vendored
View File

@ -16016,6 +16016,7 @@ tests/webtbs/tw33069.pp svneol=native#text/pascal
tests/webtbs/tw33086.pp svneol=native#text/pascal
tests/webtbs/tw3309.pp svneol=native#text/plain
tests/webtbs/tw33098.pp svneol=native#text/pascal
tests/webtbs/tw33167.pp svneol=native#text/pascal
tests/webtbs/tw3320.pp svneol=native#text/plain
tests/webtbs/tw33202.pp svneol=native#text/pascal
tests/webtbs/tw3324.pp svneol=native#text/plain

View File

@ -2440,6 +2440,8 @@ end;
operator mod(const a,b:float) c:float;inline;
begin
c:= a-b * Int(a/b);
if SameValue(abs(c),abs(b)) then
c:=0.0;
end;
function ifthen(val:boolean;const iftrue:integer; const iffalse:integer= 0) :integer;

22
tests/webtbs/tw33167.pp Normal file
View File

@ -0,0 +1,22 @@
{$ifndef FPUNONE}
uses
math;
var
a,b,c : double;
begin
a:=7.7;
b:=1.1;
c:=a mod b;
if not(SameValue(c,0.0)) then
begin
writeln(c);
halt(1);
end;
writeln('ok');
{$else FPUNONE}
begin
{$endif FPUNONE}
end.