Class DecimalExtensions
Extension methods for
Inheritance
Namespace: X10D.Math
Assembly: X10D.dll
Syntax
public static class DecimalExtensions : object
Methods
| Improve this Doc View SourceComplexSqrt(Decimal)
Returns the complex square root of this decimal number.
Declaration
public static Complex ComplexSqrt(this decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The number whose square root is to be found. |
Returns
Type | Description |
---|---|
Complex | The square root of |
IsEven(Decimal)
Returns a value indicating whether the current value is evenly divisible by 2.
Declaration
public static bool IsEven(this decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value whose parity to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
IsOdd(Decimal)
Returns a value indicating whether the current value is not evenly divisible by 2.
Declaration
public static bool IsOdd(this decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value whose parity to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
Round(Decimal)
Rounds the current value to the nearest whole number.
Declaration
public static decimal Round(this decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value to round. |
Returns
Type | Description |
---|---|
System.Decimal |
|
Round(Decimal, Decimal)
Rounds the current value to the nearest multiple of a specified number.
Declaration
public static decimal Round(this decimal value, decimal nearest)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value to round. |
System.Decimal | nearest | The nearest multiple to which |
Returns
Type | Description |
---|---|
System.Decimal |
|
Saturate(Decimal)
Saturates this decimal number.
Declaration
public static decimal Saturate(this decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value to saturate. |
Returns
Type | Description |
---|---|
System.Decimal | The saturated value. |
Remarks
This method clamps value
between 0 and 1.
Sign(Decimal)
Returns an integer that indicates the sign of this decimal number.
Declaration
public static int Sign(this decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | A signed number. |
Returns
Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
System.Int32 | A number that indicates the sign of
|
Sqrt(Decimal)
Returns the square root of this decimal number.
Declaration
public static decimal Sqrt(this decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The number whose square root is to be found. |
Returns
Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
System.Decimal | One of the values in the following table.
|
Wrap(Decimal, Decimal)
Wraps the current decimal number between 0 and a high value.
Declaration
public static decimal Wrap(this decimal value, decimal length)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value to wrap. |
System.Decimal | length | The exclusive upper bound. |
Returns
Type | Description |
---|---|
System.Decimal | The wrapped value. |
Wrap(Decimal, Decimal, Decimal)
Wraps the current decimal number between a low and a high value.
Declaration
public static decimal Wrap(this decimal value, decimal low, decimal high)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value to wrap. |
System.Decimal | low | The inclusive lower bound. |
System.Decimal | high | The exclusive upper bound. |
Returns
Type | Description |
---|---|
System.Decimal | The wrapped value. |