This documentation is archived and is not being maintained.

Decimal.Floor Method

Rounds a specified Decimal number to the closest integer toward negative infinity.

[Visual Basic]
Public Shared Function Floor( _
   ByVal d As Decimal _
) As Decimal
public static decimal Floor(
 decimal d
public: static Decimal Floor(
 Decimal d
public static function Floor(
   d : Decimal
) : Decimal;


A Decimal.

Return Value

If d has a fractional part, the next whole Decimal number toward negative infinity that is less than d.


If d doesn't have a fractional part, d is returned unchanged.


The following code sample illustrates the use of Floor.

[Visual Basic] 
Class PiggyBank
    Public ReadOnly Property Dollars() As Decimal
            Return [Decimal].Floor(MyFortune)
        End Get
    End Property

    Protected MyFortune As Decimal

    Public Sub AddPenny()
        MyFortune += 0.01D
    End Sub
End Class

class PiggyBank {
    public decimal Dollars {
        get {
            return Decimal.Floor(MyFortune);

    protected decimal MyFortune;

    public void AddPenny() {
        MyFortune += .01m;

public __gc class PiggyBank {
    Decimal Dollars() {
        return Decimal::Floor(MyFortune);

    void AddPenny() {
        Decimal::op_Addition(MyFortune, .01);

    Decimal MyFortune;

class PiggyBank {
    public function get Dollars() : Decimal {
        return Decimal.Floor(MyFortune);

    protected var MyFortune : Decimal;

    public function AddPenny() {
        MyFortune = Decimal.Add(MyFortune, 0.01);


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Decimal Structure | Decimal Members | System Namespace | Round | Truncate