C# Math Floor(Double)

Description

Math Floor(Double) returns the largest integer less than or equal to the specified double-precision floating-point number.

Syntax

Math.Floor(Double) has the following syntax.


public static double Floor(
  double d
)

Parameters

Math.Floor(Double) has the following parameters.

  • d - A double-precision floating-point number.

Returns

Math.Floor(Double) method returns The largest integer less than or equal to d. If d is equal to NaN, NegativeInfinity, or PositiveInfinity, that value is returned.

Example

The following example illustrates the Math.Floor(Double) method and contrasts it with the Ceiling(Double) method.


using System;/*from   ww w.ja va  2 s  .c o m*/

public class MainClass{
  public static void Main(String[] argv){  
   Console.WriteLine(Math.Floor(1.2));
    

  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version