Home  |  Delphi .net Home  |  System.Decimal  |  Floor Method
  
Floor  
Method  
Finds the lowest relative integer value nearest to the specified decimal
Decimal Structure
System NameSpace
CF1.  Function Floor ( Value : Decimal ) : Decimal; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
If Value has a fractional part, then the value returned is rounded to the nearest integer in the direction of negative infinity.
 
Therefore negative numbers become larger in absolute value, and positive numbers become smaller.
Notes
Compare with Round and Truncate.

Static methods are not methods of an object - they are simply class functions or procedures available at any time.
Microsoft MSDN Links
System
System.Decimal
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  valueA, valueB : Decimal;
  result         : Decimal;

begin
  valueA := 1.2;
  valueB := -1.2;

  Console.WriteLine('valueA       = {0}', valueA.ToString);
  Console.WriteLine('valueB       = {0}', valueB.ToString);

Console.WriteLine;

  result := System.Decimal.Floor(valueA);
  Console.WriteLine('valueA floor = ' + result.ToString);
  result := System.Decimal.Floor(valueB);
  Console.WriteLine('valueB floor = ' + result.ToString);

  Console.ReadLine;
end.
   valueA       = 1.2
   valueB       = -1.2
  
   valueA floor = 1
   valueB floor = -2
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author