DelphiBasics
Frac
Function
The fractional part of a floating point number System unit
 function Frac(const Number Extended):Extended;
Description
The Frac function returns the fractional part of a floating point number.
Related commands
IntThe integer part of a floating point number as a float
RoundRounds a floating point number to an integer
TruncThe integer part of a floating point number
 Download this web site as a Windows program.




 
Example code : A simple example
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;
Show full unit code
  Round(12.75) = 13
  Trunc(12.75) = 12
   Int(12.75) = 12
   Frac(12.75) = 0.75
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page