Class NumberUtils
Utility class for number operations
Inherited Members
Namespace: Serenity.Shared.Utils
Assembly: Serenity.Shared.dll
Syntax
public static class NumberUtils
Methods
Ceiling(double)
Gets the smallest integer greater than or equal to the specified value
Declaration
public static double Ceiling(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to evaluate |
Returns
| Type | Description |
|---|---|
| double | The smallest integer greater than or equal to the specified value |
Ceiling(float)
Gets the smallest integer greater than or equal to the specified value
Declaration
public static double Ceiling(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The value to evaluate |
Returns
| Type | Description |
|---|---|
| double | The smallest integer greater than or equal to the specified value |
CeilingToInt(double)
Gets the smallest integer greater than or equal to the specified value
Declaration
public static int CeilingToInt(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to evaluate |
Returns
| Type | Description |
|---|---|
| int | The smallest integer greater than or equal to the specified value |
CeilingToInt(float)
Gets the smallest integer greater than or equal to the specified value
Declaration
public static int CeilingToInt(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The value to evaluate |
Returns
| Type | Description |
|---|---|
| int | The smallest integer greater than or equal to the specified value |
Clamp(float, float, float)
Clamp a float value between a minimum and maximum range
Declaration
public static float Clamp(float value, float min, float max)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The float value to clamp |
| float | min | The minimum allowable value |
| float | max | The maximum allowable value |
Returns
| Type | Description |
|---|---|
| float | The clamped float value |
DoubleToFloat(double)
Convert a double to a float
Declaration
public static float DoubleToFloat(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The double value to convert |
Returns
| Type | Description |
|---|---|
| float | The converted float value |
FloatToDouble(float)
Convert a float to a double
Declaration
public static double FloatToDouble(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The float value to convert |
Returns
| Type | Description |
|---|---|
| double | The converted double value |
Floor(double)
Gets the largest integer less than or equal to the specified value
Declaration
public static double Floor(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to evaluate |
Returns
| Type | Description |
|---|---|
| double | The largest integer less than or equal to the specified value |
Floor(float)
Gets the largest integer less than or equal to the specified value
Declaration
public static double Floor(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The value to evaluate |
Returns
| Type | Description |
|---|---|
| double | The largest integer less than or equal to the specified value |
FloorToInt(double)
Gets the largest integer less than or equal to the specified value
Declaration
public static int FloorToInt(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to evaluate |
Returns
| Type | Description |
|---|---|
| int | The largest integer less than or equal to the specified value |
FloorToInt(float)
Gets the largest integer less than or equal to the specified value
Declaration
public static int FloorToInt(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The value to evaluate |
Returns
| Type | Description |
|---|---|
| int | The largest integer less than or equal to the specified value |
Round(float)
Round a float value to the nearest integer
Declaration
public static int Round(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The float value to round |
Returns
| Type | Description |
|---|---|
| int | The rounded integer value |
Round(float, int)
Round a float value to a specified number of decimal places
Declaration
public static float Round(float value, int decimals = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The float value to round |
| int | decimals | The number of decimal places to round to (default is 0) |
Returns
| Type | Description |
|---|---|
| float | The rounded float value |