C# Class Evbpc.Framework.Utilities.Extensions.NumericExtensions

A collection of methods which may be used to assist in conversions from certain numeric types to others.
Afficher le fichier Open project: EBrown8534/Framework

Méthodes publiques

Méthode Description
FloatToUInt16 ( float value, byte decimalBits ) : ushort

Converts a float value to a rounded ushort, with the specified number of decimals.

GetUShortMask ( byte bits ) : ushort

Constructs a mask which can be used for FloatToUInt16(float, byte) and UInt16ToFloat(ushort, byte).

UInt16ToFloat ( ushort value, byte decimalBits ) : float

Converts a rounded ushort value to a float, with the specified number of decimals.

Method Details

FloatToUInt16() public static méthode

Converts a float value to a rounded ushort, with the specified number of decimals.
public static FloatToUInt16 ( float value, byte decimalBits ) : ushort
value float The float value to convert.
decimalBits byte The number of bits in the ushort value which represent decimals.
Résultat ushort

GetUShortMask() public static méthode

Constructs a mask which can be used for FloatToUInt16(float, byte) and UInt16ToFloat(ushort, byte).
public static GetUShortMask ( byte bits ) : ushort
bits byte The number of bits that should be set in the mask.
Résultat ushort

UInt16ToFloat() public static méthode

Converts a rounded ushort value to a float, with the specified number of decimals.
public static UInt16ToFloat ( ushort value, byte decimalBits ) : float
value ushort The ushort value to convert.
decimalBits byte The number of bits in the ushort value which represent decimals.
Résultat float