Home  |  Delphi .net Home  |  System.Math  |  Floor Method
Floor  
Method  
Rounds the number down to the nearest integer
Math Class
System NameSpace
CF1.  Function Floor ( Value : Double; ) : Double; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Returns as a Double the nearest integer that is equal to or less than the given Value.
Notes
Round, Trunc, Inc and Frac in the Delphi run time library System unit perform differently to Floor.

Static methods are not methods of an object - they are simply class functions or procedures available at any time.
Microsoft MSDN Links
System
System.Math
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  float : Double;
begin
  float := System.Math.Floor(12.0);
  Console.WriteLine('Floor(12.0)  = {0}', float.ToString);

  float := System.Math.Floor(12.34);
  Console.WriteLine('Floor(12.34) = {0}', float.ToString);

  float := System.Math.Floor(12.99);
  Console.WriteLine('Floor(12.99) = {0}', float.ToString);

  Console.ReadLine;
end.
Show full unit code
  Floor(12.0)  = 12
  Floor(12.34) = 12
  Floor(12.99) = 12
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author