Div
From Free Pascal wiki
Jump to navigationJump to search
│
Deutsch (de) │
English (en) │
español (es) │
suomi (fi) │
français (fr) │
русский (ru) │
Div is division in which the fractional part (remainder) is discarded. The expression (a div b) returns the integer part of the result of dividing two integers. This is in contrast to the expression (a / b) which returns a Real result. Both sides of an expression using div must be one of the integer types. Using a real with div will result in a compile error: "Error: Operator is not overloaded:"
Example:
var
i : ShortInt = 16;
j : ShortInt = 3;
q : QWord = 1000;
r : QWord = 300;
begin
i := 16;
j := 3;
WriteLn(i div j);
WriteLn(i / j);
WriteLn(q div r);
end.
Output:
5
5.3333333333333330E+000
3