티스토리 뷰

VCL

(URL) ROUND / TRUNC / MOD on DELPHI

Think Hub 2019. 8. 26. 15:38

 

http://www.delphibasics.co.uk/RTL.asp?Name=Trunc

 

Delphi Basics : Trunc command

Description The Trunc function returns the integer part of a floating point number.   It returns this part as an Integer value. Notes The Int function does the same, but returns the integer in a floating point value. Related commands Frac The fractional pa

www.delphibasics.co.uk

begin
  ShowMessage('Round(12.75) = '+IntToStr(Round(12.75)));
  ShowMessage('Trunc(12.75) = '+IntToStr(Trunc(12.75)));
  ShowMessage('  Int(12.75) = '+FloatToStr(Int(12.75)));
  ShowMessage(' Frac(12.75) = '+FloatToStr(Frac(12.75)));
end;

   Round(12.75) = 13
   Trunc(12.75) = 12
     Int(12.75) = 12
   Frac(12.75) = 0.75
댓글