Node:Int, Next:Integer, Previous:Insert, Up:Reference
function Int (x: Real): Real;
Int returns the integer part of a floating point number as a
floating point number. Use Trunc to get the integer part as
an integer.
Int is a UCSD Pascal extension.
program IntDemo;
begin
WriteLn (Frac (12.345) : 1 : 5); { 0.34500 }
WriteLn (Int (12.345) : 1 : 5); { 12.00000 }
WriteLn (Round (12.345) : 1); { 12 }
WriteLn (Trunc (12.345) : 1); { 12 }
WriteLn (Frac (-12.345) : 1 : 5); { -0.34500 }
WriteLn (Int (-12.345) : 1 : 5); { -12.00000 }
WriteLn (Round (-12.345) : 1); { -12 }
WriteLn (Trunc (-12.345) : 1); { -12 }
WriteLn (Frac (12.543) : 1 : 5); { 0.54300 }
WriteLn (Int (12.543) : 1 : 5); { 12.00000 }
WriteLn (Round (12.543) : 1); { 13 }
WriteLn (Trunc (12.543) : 1); { 12 }
WriteLn (Frac (-12.543) : 1 : 5); { -0.54300 }
WriteLn (Int (-12.543) : 1 : 5); { -12.00000 }
WriteLn (Round (-12.543) : 1); { -13 }
WriteLn (Trunc (-12.543) : 1); { -12 }
end.