DecimalN

Ecng.Interop

Represents a decimal number with a variable exponent.

实现: IFormattable

属性

Exponent
public byte Exponent { get; set; }
value = decimalN.Exponent
decimalN.Exponent = value

Gets or sets the exponent used for scaling the decimal value. The exponent must be between 0 and 8 (inclusive).

方法

FromDecimal
public static DecimalN FromDecimal(decimal value, byte exponent)
result = DecimalN.FromDecimal(value, exponent)

Creates a DecimalN from a decimal value and a specified exponent.

value
The decimal value.
exponent
The exponent to use for scaling.

返回值: A DecimalN representing the scaled value.

GetFactor
private decimal GetFactor()
result = decimalN.GetFactor()

Calculates the scaling factor as a decimal based on the exponent.

返回值: A decimal scaling factor.

op_Explicit(DecimalN) : DecimalN

Explicitly converts a decimal to a DecimalN value using the default exponent.

value
The decimal value.

返回值: A DecimalN representing the same value.

op_Implicit(Decimal) : decimal

Implicitly converts a DecimalN value to a decimal.

value
The DecimalN value.

返回值: A decimal representing the scaled value.

ToString
public override string ToString()
result = decimalN.ToString()

Returns a string representation of the tuple, with values separated by commas.

返回值: A string representing the tuple's values.

ToString
public string ToString(string format, IFormatProvider formatProvider)
result = decimalN.ToString(format, formatProvider)

字段

Mantissa
public long Mantissa
value = decimalN.Mantissa

The mantissa component of the decimal number.