MathF.Floor() Method in C# with Examples
In C#, MathF.Floor(Single) is a MathF class method. This method is used to find the largest integer , which is less than or equal to the specified float value in the argument list.
Syntax: public static float Floor (float x);
Here, x is the float(Single) value whose floor value has to be calculated.Return Type: This method return the largest integral value which will be less than or equal to x.
Example:
// C# program to illustrate the // MathF.Floor(Single) Method using System; class GFG { // Main method static void Main() { // taking float values float x1 = 37.00f; float x2 = 99.99f; float x3 = 0.2154f; float x4 = 123.123f; float x5 = -2.2f; float x6 = -123.123f; // calling the method result(x1); result(x2); result(x3); result(x4); result(x5); result(x6); } public static void result(float t1) { // Print the original values // and Floor values Console.WriteLine("Input Value = " + t1); // using the MathF.Floor() Method Console.WriteLine("Floor value = " + MathF.Floor(t1)); } } |
Input Value = 37 Floor value = 37 Input Value = 99.99 Floor value = 99 Input Value = 0.2154 Floor value = 0 Input Value = 123.123 Floor value = 123 Input Value = -2.2 Floor value = -3 Input Value = -123.123 Floor value = -124
Recommended Posts:
- MathF.Exp() Method in C# with Examples
- MathF.Sin() Method in C# with Examples
- MathF.Abs() Method in C# with Examples
- MathF.Pow() Method in C# with Examples
- MathF.Tan() Method in C# with Examples
- MathF.Min() Method in C# with Examples
- MathF.Log() Method in C# with Examples
- MathF.Cos() Method in C# with Examples
- MathF.Max() Method in C# with Examples
- UInt64.Equals Method in C# with Examples
- Single.GetTypeCode Method in C# with Examples
- UInt16.ToString() Method in C# with Examples | Set - 1
- Single.Equals() Method in C# with Examples
- Single.GetHashCode() Method in C# with Examples
- UInt32.Equals Method in C# with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



