fixed entier routine: did not work properly for negative args
This commit is contained in:
parent
55a133aa3c
commit
a49ffb7945
1 changed files with 1 additions and 1 deletions
|
@ -48,7 +48,7 @@ PROCEDURE entier(x: REAL): INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF x < 0.0 THEN
|
IF x < 0.0 THEN
|
||||||
i := TRUNC(-x);
|
i := TRUNC(-x);
|
||||||
IF FLOAT(-i) = x THEN
|
IF FLOAT(i) = -x THEN
|
||||||
RETURN -i;
|
RETURN -i;
|
||||||
ELSE
|
ELSE
|
||||||
RETURN -i -1;
|
RETURN -i -1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue