Decimal::Floor Method (Decimal)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public:
static Decimal Floor(
	Decimal d
)

Parameters

d
Type: System::Decimal

The value to round.

Return Value

Type: System::Decimal

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

-or-

If d doesn't have a fractional part, d is returned unchanged. Note that the method returns an integral value of type Decimal.

The behavior of this method follows IEEE Standard 754, Section 4. This kind of rounding is sometimes called rounding toward negative infinity. In other words, if d is positive, any fractional component is truncated. If d is negative, the presence of any fractional component causes it to be rounded to the smaller integer. The operation of this method differs from the Ceiling method, which supports rounding toward positive infinity.

The following example illustrates the Floor method and contrasts it with the Ceiling method.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: