C# Класс Evbpc.Framework.Utilities.Extensions.NumericExtensions

A collection of methods which may be used to assist in conversions from certain numeric types to others.
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Описание методов

FloatToUInt16() публичный статический Метод

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.
Результат ushort

GetUShortMask() публичный статический Метод

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.
Результат ushort

UInt16ToFloat() публичный статический Метод

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.
Результат float