Decimal 구조체
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
10진수 부동 소수점 숫자를 나타냅니다.
public value class System::Decimal : IComparable, IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, IFormattable
public value class System::Decimal : IComparable, IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, IFormattable, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class System::Decimal : IComparable, IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, ISpanFormattable, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class System::Decimal : IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, IParsable<System::Decimal>, ISpanParsable<System::Decimal>, System::Numerics::IAdditionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IAdditiveIdentity<System::Decimal, System::Decimal>, System::Numerics::IComparisonOperators<System::Decimal, System::Decimal, bool>, System::Numerics::IDecrementOperators<System::Decimal>, System::Numerics::IDivisionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IEqualityOperators<System::Decimal, System::Decimal, bool>, System::Numerics::IFloatingPoint<System::Decimal>, System::Numerics::IFloatingPointConstants<System::Decimal>, System::Numerics::IIncrementOperators<System::Decimal>, System::Numerics::IMinMaxValue<System::Decimal>, System::Numerics::IModulusOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IMultiplicativeIdentity<System::Decimal, System::Decimal>, System::Numerics::IMultiplyOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::INumber<System::Decimal>, System::Numerics::INumberBase<System::Decimal>, System::Numerics::ISignedNumber<System::Decimal>, System::Numerics::ISubtractionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IUnaryNegationOperators<System::Decimal, System::Decimal>, System::Numerics::IUnaryPlusOperators<System::Decimal, System::Decimal>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class System::Decimal : IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, IParsable<System::Decimal>, ISpanParsable<System::Decimal>, IUtf8SpanParsable<System::Decimal>, System::Numerics::IAdditionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IAdditiveIdentity<System::Decimal, System::Decimal>, System::Numerics::IComparisonOperators<System::Decimal, System::Decimal, bool>, System::Numerics::IDecrementOperators<System::Decimal>, System::Numerics::IDivisionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IEqualityOperators<System::Decimal, System::Decimal, bool>, System::Numerics::IFloatingPoint<System::Decimal>, System::Numerics::IFloatingPointConstants<System::Decimal>, System::Numerics::IIncrementOperators<System::Decimal>, System::Numerics::IMinMaxValue<System::Decimal>, System::Numerics::IModulusOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IMultiplicativeIdentity<System::Decimal, System::Decimal>, System::Numerics::IMultiplyOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::INumber<System::Decimal>, System::Numerics::INumberBase<System::Decimal>, System::Numerics::ISignedNumber<System::Decimal>, System::Numerics::ISubtractionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IUnaryNegationOperators<System::Decimal, System::Decimal>, System::Numerics::IUnaryPlusOperators<System::Decimal, System::Decimal>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class System::Decimal : IComparable, IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, IFormattable, System::Runtime::Serialization::IDeserializationCallback
public value class System::Decimal : IComparable, IConvertible, IFormattable
public value class System::Decimal : IComparable, IComparable<System::Decimal>, IEquatable<System::Decimal>, IFormattable
public struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable
public readonly struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public readonly struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, ISpanFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public readonly struct Decimal : IComparable<decimal>, IConvertible, IEquatable<decimal>, IParsable<decimal>, ISpanParsable<decimal>, System.Numerics.IAdditionOperators<decimal,decimal,decimal>, System.Numerics.IAdditiveIdentity<decimal,decimal>, System.Numerics.IComparisonOperators<decimal,decimal,bool>, System.Numerics.IDecrementOperators<decimal>, System.Numerics.IDivisionOperators<decimal,decimal,decimal>, System.Numerics.IEqualityOperators<decimal,decimal,bool>, System.Numerics.IFloatingPoint<decimal>, System.Numerics.IFloatingPointConstants<decimal>, System.Numerics.IIncrementOperators<decimal>, System.Numerics.IMinMaxValue<decimal>, System.Numerics.IModulusOperators<decimal,decimal,decimal>, System.Numerics.IMultiplicativeIdentity<decimal,decimal>, System.Numerics.IMultiplyOperators<decimal,decimal,decimal>, System.Numerics.INumber<decimal>, System.Numerics.INumberBase<decimal>, System.Numerics.ISignedNumber<decimal>, System.Numerics.ISubtractionOperators<decimal,decimal,decimal>, System.Numerics.IUnaryNegationOperators<decimal,decimal>, System.Numerics.IUnaryPlusOperators<decimal,decimal>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public readonly struct Decimal : IComparable<decimal>, IConvertible, IEquatable<decimal>, IParsable<decimal>, ISpanParsable<decimal>, IUtf8SpanParsable<decimal>, System.Numerics.IAdditionOperators<decimal,decimal,decimal>, System.Numerics.IAdditiveIdentity<decimal,decimal>, System.Numerics.IComparisonOperators<decimal,decimal,bool>, System.Numerics.IDecrementOperators<decimal>, System.Numerics.IDivisionOperators<decimal,decimal,decimal>, System.Numerics.IEqualityOperators<decimal,decimal,bool>, System.Numerics.IFloatingPoint<decimal>, System.Numerics.IFloatingPointConstants<decimal>, System.Numerics.IIncrementOperators<decimal>, System.Numerics.IMinMaxValue<decimal>, System.Numerics.IModulusOperators<decimal,decimal,decimal>, System.Numerics.IMultiplicativeIdentity<decimal,decimal>, System.Numerics.IMultiplyOperators<decimal,decimal,decimal>, System.Numerics.INumber<decimal>, System.Numerics.INumberBase<decimal>, System.Numerics.ISignedNumber<decimal>, System.Numerics.ISubtractionOperators<decimal,decimal,decimal>, System.Numerics.IUnaryNegationOperators<decimal,decimal>, System.Numerics.IUnaryPlusOperators<decimal,decimal>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable, System.Runtime.Serialization.IDeserializationCallback
public readonly struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable, System.Runtime.Serialization.IDeserializationCallback
[System.Serializable]
public struct Decimal : IComparable, IConvertible, IFormattable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable, System.Runtime.Serialization.IDeserializationCallback
public struct Decimal : IComparable, IComparable<decimal>, IEquatable<decimal>, IFormattable
type decimal = struct
interface IConvertible
interface IFormattable
type decimal = struct
interface IConvertible
interface IFormattable
interface IDeserializationCallback
interface ISerializable
type decimal = struct
interface IConvertible
interface ISpanFormattable
interface IFormattable
interface IDeserializationCallback
interface ISerializable
type decimal = struct
interface IConvertible
interface IFormattable
interface IParsable<decimal>
interface ISpanFormattable
interface ISpanParsable<decimal>
interface IAdditionOperators<decimal, decimal, decimal>
interface IAdditiveIdentity<decimal, decimal>
interface IComparisonOperators<decimal, decimal, bool>
interface IEqualityOperators<decimal, decimal, bool>
interface IDecrementOperators<decimal>
interface IDivisionOperators<decimal, decimal, decimal>
interface IFloatingPoint<decimal>
interface IFloatingPointConstants<decimal>
interface INumberBase<decimal>
interface IIncrementOperators<decimal>
interface IMultiplicativeIdentity<decimal, decimal>
interface IMultiplyOperators<decimal, decimal, decimal>
interface ISubtractionOperators<decimal, decimal, decimal>
interface IUnaryNegationOperators<decimal, decimal>
interface IUnaryPlusOperators<decimal, decimal>
interface IModulusOperators<decimal, decimal, decimal>
interface INumber<decimal>
interface ISignedNumber<decimal>
interface IMinMaxValue<decimal>
interface IDeserializationCallback
interface ISerializable
type decimal = struct
interface IConvertible
interface IFormattable
interface IParsable<decimal>
interface ISpanFormattable
interface ISpanParsable<decimal>
interface IAdditionOperators<decimal, decimal, decimal>
interface IAdditiveIdentity<decimal, decimal>
interface IComparisonOperators<decimal, decimal, bool>
interface IEqualityOperators<decimal, decimal, bool>
interface IDecrementOperators<decimal>
interface IDivisionOperators<decimal, decimal, decimal>
interface IFloatingPoint<decimal>
interface IFloatingPointConstants<decimal>
interface INumberBase<decimal>
interface IIncrementOperators<decimal>
interface IMultiplicativeIdentity<decimal, decimal>
interface IMultiplyOperators<decimal, decimal, decimal>
interface ISubtractionOperators<decimal, decimal, decimal>
interface IUnaryNegationOperators<decimal, decimal>
interface IUnaryPlusOperators<decimal, decimal>
interface IUtf8SpanFormattable
interface IUtf8SpanParsable<decimal>
interface IModulusOperators<decimal, decimal, decimal>
interface INumber<decimal>
interface ISignedNumber<decimal>
interface IMinMaxValue<decimal>
interface IDeserializationCallback
interface ISerializable
type decimal = struct
interface IConvertible
interface IFormattable
interface IDeserializationCallback
[<System.Serializable>]
type decimal = struct
interface IFormattable
interface IConvertible
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type decimal = struct
interface IFormattable
interface IConvertible
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type decimal = struct
interface IFormattable
interface IConvertible
interface IDeserializationCallback
type decimal = struct
interface IFormattable
Public Structure Decimal
Implements IComparable, IComparable(Of Decimal), IConvertible, IEquatable(Of Decimal), IFormattable
Public Structure Decimal
Implements IComparable, IComparable(Of Decimal), IConvertible, IDeserializationCallback, IEquatable(Of Decimal), IFormattable, ISerializable
Public Structure Decimal
Implements IComparable, IComparable(Of Decimal), IConvertible, IDeserializationCallback, IEquatable(Of Decimal), ISerializable, ISpanFormattable
Public Structure Decimal
Implements IAdditionOperators(Of Decimal, Decimal, Decimal), IAdditiveIdentity(Of Decimal, Decimal), IComparable(Of Decimal), IComparisonOperators(Of Decimal, Decimal, Boolean), IConvertible, IDecrementOperators(Of Decimal), IDeserializationCallback, IDivisionOperators(Of Decimal, Decimal, Decimal), IEqualityOperators(Of Decimal, Decimal, Boolean), IEquatable(Of Decimal), IFloatingPoint(Of Decimal), IFloatingPointConstants(Of Decimal), IIncrementOperators(Of Decimal), IMinMaxValue(Of Decimal), IModulusOperators(Of Decimal, Decimal, Decimal), IMultiplicativeIdentity(Of Decimal, Decimal), IMultiplyOperators(Of Decimal, Decimal, Decimal), INumber(Of Decimal), INumberBase(Of Decimal), IParsable(Of Decimal), ISerializable, ISignedNumber(Of Decimal), ISpanParsable(Of Decimal), ISubtractionOperators(Of Decimal, Decimal, Decimal), IUnaryNegationOperators(Of Decimal, Decimal), IUnaryPlusOperators(Of Decimal, Decimal)
Public Structure Decimal
Implements IAdditionOperators(Of Decimal, Decimal, Decimal), IAdditiveIdentity(Of Decimal, Decimal), IComparable(Of Decimal), IComparisonOperators(Of Decimal, Decimal, Boolean), IConvertible, IDecrementOperators(Of Decimal), IDeserializationCallback, IDivisionOperators(Of Decimal, Decimal, Decimal), IEqualityOperators(Of Decimal, Decimal, Boolean), IEquatable(Of Decimal), IFloatingPoint(Of Decimal), IFloatingPointConstants(Of Decimal), IIncrementOperators(Of Decimal), IMinMaxValue(Of Decimal), IModulusOperators(Of Decimal, Decimal, Decimal), IMultiplicativeIdentity(Of Decimal, Decimal), IMultiplyOperators(Of Decimal, Decimal, Decimal), INumber(Of Decimal), INumberBase(Of Decimal), IParsable(Of Decimal), ISerializable, ISignedNumber(Of Decimal), ISpanParsable(Of Decimal), ISubtractionOperators(Of Decimal, Decimal, Decimal), IUnaryNegationOperators(Of Decimal, Decimal), IUnaryPlusOperators(Of Decimal, Decimal), IUtf8SpanParsable(Of Decimal)
Public Structure Decimal
Implements IComparable, IComparable(Of Decimal), IConvertible, IDeserializationCallback, IEquatable(Of Decimal), IFormattable
Public Structure Decimal
Implements IComparable, IConvertible, IFormattable
Public Structure Decimal
Implements IComparable, IComparable(Of Decimal), IEquatable(Of Decimal), IFormattable
- 상속
- 특성
- 구현
-
IComparable IComparable<Decimal> IConvertible IEquatable<Decimal> IFormattable IDeserializationCallback ISerializable ISpanFormattable IComparable<TSelf> IEquatable<TSelf> IParsable<Decimal> IParsable<TSelf> ISpanParsable<Decimal> ISpanParsable<TSelf> IAdditionOperators<Decimal,Decimal,Decimal> IAdditionOperators<TSelf,TSelf,TSelf> IAdditiveIdentity<Decimal,Decimal> IAdditiveIdentity<TSelf,TSelf> IComparisonOperators<Decimal,Decimal,Boolean> IComparisonOperators<TSelf,TSelf,Boolean> IDecrementOperators<Decimal> IDecrementOperators<TSelf> IDivisionOperators<Decimal,Decimal,Decimal> IDivisionOperators<TSelf,TSelf,TSelf> IEqualityOperators<Decimal,Decimal,Boolean> IEqualityOperators<TSelf,TOther,TResult> IEqualityOperators<TSelf,TSelf,Boolean> IFloatingPoint<Decimal> IFloatingPointConstants<Decimal> IFloatingPointConstants<TSelf> IIncrementOperators<Decimal> IIncrementOperators<TSelf> IMinMaxValue<Decimal> IModulusOperators<Decimal,Decimal,Decimal> IModulusOperators<TSelf,TSelf,TSelf> IMultiplicativeIdentity<Decimal,Decimal> IMultiplicativeIdentity<TSelf,TSelf> IMultiplyOperators<Decimal,Decimal,Decimal> IMultiplyOperators<TSelf,TSelf,TSelf> INumber<Decimal> INumber<TSelf> INumberBase<Decimal> INumberBase<TSelf> ISignedNumber<Decimal> ISignedNumber<TSelf> ISubtractionOperators<Decimal,Decimal,Decimal> ISubtractionOperators<TSelf,TSelf,TSelf> IUnaryNegationOperators<Decimal,Decimal> IUnaryNegationOperators<TSelf,TSelf> IUnaryPlusOperators<Decimal,Decimal> IUnaryPlusOperators<TSelf,TSelf> IUtf8SpanFormattable IUtf8SpanParsable<Decimal> IUtf8SpanParsable<TSelf>
예제
다음 코드 예제에서는 Decimal의 사용법을 보여줍니다.
/// <summary>
/// Keeping my fortune in Decimals to avoid the round-off errors.
/// </summary>
public ref class PiggyBank
{
protected:
Decimal MyFortune;
public:
void AddPenny()
{
MyFortune = System::Decimal::Add( MyFortune, Decimal(.01) );
}
System::Decimal Capacity()
{
return MyFortune.MaxValue;
}
Decimal Dollars()
{
return Decimal::Floor( MyFortune );
}
Decimal Cents()
{
return Decimal::Subtract( MyFortune, Decimal::Floor( MyFortune ) );
}
virtual System::String^ ToString() override
{
return MyFortune.ToString("C")+" in piggy bank";
}
};
}
/// <summary>
/// Keeping my fortune in Decimals to avoid the round-off errors.
/// </summary>
class PiggyBank {
protected decimal MyFortune;
public void AddPenny() {
MyFortune = Decimal.Add(MyFortune, .01m);
}
public decimal Capacity {
get {
return Decimal.MaxValue;
}
}
public decimal Dollars {
get {
return Decimal.Floor(MyFortune);
}
}
public decimal Cents {
get {
return Decimal.Subtract(MyFortune, Decimal.Floor(MyFortune));
}
}
public override string ToString() {
return MyFortune.ToString("C")+" in piggy bank";
}
}
/// Keeping my fortune in Decimals to avoid the round-off errors.
type PiggyBank() =
let mutable myFortune = 0m
member _.AddPenny() =
myFortune <- Decimal.Add(myFortune, 0.01m)
member _.Capacity =
Decimal.MaxValue
member _.Dollars =
Decimal.Floor myFortune
member _.Cents =
Decimal.Subtract(myFortune, Decimal.Floor myFortune)
override _.ToString() =
$"{myFortune:C} in piggy bank"
' Keeping my fortune in Decimals to avoid the round-off errors.
Class PiggyBank
Protected MyFortune As Decimal
Public Sub AddPenny()
MyFortune = [Decimal].Add(MyFortune, 0.01D)
End Sub
Public ReadOnly Property Capacity() As Decimal
Get
Return [Decimal].MaxValue
End Get
End Property
Public ReadOnly Property Dollars() As Decimal
Get
Return [Decimal].Floor(MyFortune)
End Get
End Property
Public ReadOnly Property Cents() As Decimal
Get
Return [Decimal].Subtract(MyFortune, [Decimal].Floor(MyFortune))
End Get
End Property
Public Overrides Function ToString() As String
Return MyFortune.ToString("C") + " in piggy bank"
End Function
End Class
설명
값 형식은 Decimal 양의 79,228,162,514,264,337,593,543,950에 이르는 소수 자릿수를 나타냅니다. 음수 79,228,162,514,264,337,593,543,950,335. 의 Decimal
기본값은 0입니다. Decimal 값 형식은 많은 수의 중요한 정수 및 소수 자릿수가 필요하고 반올림 오류가 없는 재무 계산에 적합합니다. 형식은 Decimal 반올림할 필요가 없습니다. 오히려 반올림으로 인한 오류를 최소화합니다. 예를 들어 다음 코드는 1 대신 0.9999999999999999999999999999의 결과를 생성합니다.
using namespace System;
void main()
{
Decimal dividend = Decimal::One;
Decimal divisor = 3;
// The following displays 0.9999999999999999999999999999 to the console
Console::WriteLine(dividend/divisor * divisor);
}
decimal dividend = Decimal.One;
decimal divisor = 3;
// The following displays 0.9999999999999999999999999999 to the console
Console.WriteLine(dividend/divisor * divisor);
let dividend = Decimal.One
let divisor = 3m
// The following displays 0.9999999999999999999999999999 to the console
printfn $"{dividend/divisor * divisor}"
Dim dividend As Decimal = Decimal.One
Dim divisor As Decimal = 3
' The following displays 0.9999999999999999999999999999 to the console
Console.WriteLine(dividend/divisor * divisor)
나누기 및 곱하기의 결과가 메서드에 Round 전달되면 다음 코드와 같이 정밀도의 손실이 발생하지 않습니다.
using namespace System;
void main()
{
Decimal dividend = Decimal::One;
Decimal divisor = 3;
// The following displays 1.00 to the console
Console::WriteLine(Math::Round(dividend/divisor * divisor, 2));
}
decimal dividend = Decimal.One;
decimal divisor = 3;
// The following displays 1.00 to the console
Console.WriteLine(Math.Round(dividend/divisor * divisor, 2));
let dividend = Decimal.One
let divisor = 3m
// The following displays 1.00 to the console
printfn $"{Math.Round(dividend/divisor * divisor, 2)}"
Dim dividend As Decimal = Decimal.One
Dim divisor As Decimal = 3
' The following displays 1.00 to the console
Console.WriteLine(Math.Round(dividend/divisor * divisor, 2))
10진수는 부호, 값의 각 숫자가 0에서 9 사이인 숫자 값, 숫자 값의 정수 부분과 소수 부분을 구분하는 부동 소수점 위치를 나타내는 배율 인수로 구성된 부동 소수점 값입니다.
값의 Decimal
이진 표현은 96비트 정수로 구성된 128비트와 소수 자릿수 부분을 지정하는 데 사용되는 부호 및 배율 인수와 같은 항목을 나타내는 32비트 플래그 집합입니다. 따라서 형식(-296~296)/10(0~28)) 값의 Decimal 이진 표현입니다. 여기서 -(296-1)는 와 같MinValue고 296-1은 와 같습니다MaxValue. 값의 이진 표현 Decimal 및 예제에 대한 자세한 내용은 생성자 및 메서드를 GetBits 참조 Decimal(Int32[]) 하세요.
또한 배율 인수는 후행 0을 숫자로 Decimal 유지합니다. 후행 0은 산술 또는 비교 연산의 Decimal 숫자 값에 영향을 미치지 않습니다. 그러나 적절한 형식 문자열이 적용되는 경우 메서드에서 ToString 후행 0을 표시할 수 있습니다.
변환 고려 사항
이 형식은 값을 , , , Int64Int32ByteUInt16Int16UInt32및 값으로 SByte변환 Decimal 하는 UInt64 메서드를 제공합니다. 이러한 정수 형식에서 로 Decimal 변환하면 정보를 손실하거나 예외를 throw하지 않는 변환이 확대됩니다.
에서 Decimal 정수 형식으로 변환하면 값을 가장 가까운 정수 값으로 반올림 Decimal 하는 변환이 0으로 좁혀집니다. C#과 같은 일부 언어는 값 Char 으로의 Decimal 변환도 지원합니다. 이러한 변환의 결과를 대상 형식으로 나타낼 수 없는 경우 예외가 OverflowException throw됩니다.
또한 형식은 Decimal 값을 및 Double 값으로 변환 Decimal 하는 Single 메서드를 제공합니다. Decimal 에서 또는 Double 로 Single 변환하면 전체 자릿수가 손실될 수 있지만 변환된 값의 크기에 대한 정보는 손실될 수 있는 변환이 축소됩니다. 변환은 예외를 throw하지 않습니다.
변환 결과를 로 나타낼 Decimal수 없는 경우 또는 에서 DecimalDoubleSingle 변환하여 예외를 throw OverflowException 합니다.
10진수 값에 대한 작업 수행
형식은 Decimal 더하기, 빼기, 나누기, 곱하기 및 단항 부정과 같은 표준 수학 연산을 지원합니다. 메서드를 호출하여 값의 이진 표현으로 Decimal 직접 작업할 GetBits 수도 있습니다.
두 Decimal 값을 비교하려면 표준 숫자 비교 연산자를 사용하거나 또는 Equals 메서드를 호출할 CompareTo 수 있습니다.
클래스의 멤버를 호출하여 숫자의 Math 절대값 가져오기, 두 Decimal 값의 최댓값 또는 최소값 확인, 숫자 부호 가져오기, 숫자 반올림 등 다양한 숫자 연산을 수행할 수도 있습니다.
생성자
Decimal(Double) |
Decimal의 새 인스턴스를 지정된 배정밀도 부동 소수점 숫자의 값으로 초기화합니다. |
Decimal(Int32) |
Decimal의 새 인스턴스를 지정된 32비트 부호 있는 정수 값으로 초기화합니다. |
Decimal(Int32, Int32, Int32, Boolean, Byte) |
인스턴스의 구성 부분을 지정하는 매개 변수에서 Decimal의 새 인스턴스를 초기화합니다. |
Decimal(Int32[]) |
Decimal의 새 인스턴스를 이진으로 표현되며 지정한 배열에 포함된 10진 값으로 초기화합니다. |
Decimal(Int64) |
Decimal의 새 인스턴스를 지정된 64비트 부호 있는 정수 값으로 초기화합니다. |
Decimal(ReadOnlySpan<Int32>) |
Decimal의 새 인스턴스를 이진으로 표현되고 지정된 범위에 포함된 10진수 값으로 초기화합니다. |
Decimal(Single) |
Decimal의 새 인스턴스를 지정된 단정밀도 부동 소수점 숫자의 값으로 초기화합니다. |
Decimal(UInt32) |
Decimal의 새 인스턴스를 지정된 32비트 부호 없는 정수 값으로 초기화합니다. |
Decimal(UInt64) |
Decimal의 새 인스턴스를 지정된 64비트 부호 없는 정수 값으로 초기화합니다. |
필드
MaxValue |
Decimal의 가능한 최대값을 나타냅니다. 이 필드는 상수이며 읽기 전용입니다. |
MinusOne |
음수 1(-1)을 나타냅니다. |
MinValue |
Decimal의 가능한 최소값을 나타냅니다. 이 필드는 상수이며 읽기 전용입니다. |
One |
숫자 1을 나타냅니다. |
Zero |
숫자 0을 나타냅니다. |
속성
Scale |
소수 자릿수를 나타내는 0에서 28까지의 숫자인 10진수의 배율 인수를 가져옵니다. |
메서드
Abs(Decimal) |
값의 절대값을 계산합니다. |
Add(Decimal, Decimal) |
지정된 두 Decimal 값을 더합니다. |
Ceiling(Decimal) |
지정된 10진수보다 크거나 같은 최소 정수 값을 반환합니다. |
Clamp(Decimal, Decimal, Decimal) |
값을 포괄 최소값 및 최대값으로 고정합니다. |
Compare(Decimal, Decimal) |
지정된 두 Decimal 값을 비교합니다. |
CompareTo(Decimal) |
이 인스턴스를 지정된 Decimal 개체와 비교하여 상대 값의 비교를 반환합니다. |
CompareTo(Object) |
이 인스턴스를 지정된 개체와 비교하여 상대 값의 비교를 반환합니다. |
CopySign(Decimal, Decimal) |
값의 기호를 다른 값의 기호에 복사합니다. |
CreateChecked<TOther>(TOther) |
현재 형식의 표현 가능한 범위를 벗어나는 값에 대해 오버플로 예외를 throw하여 값에서 현재 형식의 instance 만듭니다. |
CreateSaturating<TOther>(TOther) |
값에서 현재 형식의 instance 만들어 현재 형식의 표현 가능한 범위를 벗어나는 값을 채도합니다. |
CreateTruncating<TOther>(TOther) |
값에서 현재 형식의 instance 만들어 현재 형식의 표현 가능한 범위를 벗어나는 값을 잘려냅니다. |
Divide(Decimal, Decimal) |
지정된 두 Decimal 값을 나눕니다. |
Equals(Decimal) |
이 인스턴스의 값과 지정된 Decimal 개체의 값이 같은지를 나타내는 값을 반환합니다. |
Equals(Decimal, Decimal) |
지정된 두 개의 Decimal 인스턴스가 같은 값을 표시하는지 여부를 나타내는 값을 반환합니다. |
Equals(Object) |
이 인스턴스와 지정된 Object가 같은 형식과 값을 표시하는지 여부를 나타내는 값을 반환합니다. |
Floor(Decimal) |
지정된 Decimal 수를 음의 무한대에 가장 가까운 정수로 반올림합니다. |
FromOACurrency(Int64) |
OLE Automation Currency 값을 포함하는 지정된 64비트 부호 있는 정수를 해당하는 Decimal 값으로 변환합니다. |
GetBits(Decimal) |
Decimal의 지정된 인스턴스 값을 해당하는 이진 표현으로 변환합니다. |
GetBits(Decimal, Span<Int32>) |
Decimal의 지정된 인스턴스 값을 해당하는 이진 표현으로 변환합니다. |
GetHashCode() |
이 인스턴스의 해시 코드를 반환합니다. |
GetTypeCode() | |
IsCanonical(Decimal) |
값이 정식 표현에 있는지 확인합니다. |
IsEvenInteger(Decimal) |
값이 짝수 정수인지 여부를 결정합니다. |
IsInteger(Decimal) |
값이 정수인지 여부를 결정합니다. |
IsNegative(Decimal) |
값이 음수인지 여부를 확인합니다. |
IsOddInteger(Decimal) |
값이 홀수 정수인지 여부를 결정합니다. |
IsPositive(Decimal) |
값이 양수인지 확인합니다. |
Max(Decimal, Decimal) |
두 값을 더 큰 컴퓨팅과 비교합니다. |
MaxMagnitude(Decimal, Decimal) |
두 값을 더 큰 컴퓨팅과 비교합니다. |
Min(Decimal, Decimal) |
두 값을 더 작은 컴퓨팅과 비교합니다. |
MinMagnitude(Decimal, Decimal) |
두 값을 더 작은 컴퓨팅과 비교합니다. |
Multiply(Decimal, Decimal) |
지정된 두 Decimal 값을 곱합니다. |
Negate(Decimal) |
지정된 Decimal 값과 음수 1을 곱한 결과를 반환합니다. |
Parse(ReadOnlySpan<Byte>, IFormatProvider) |
UTF-8자의 범위를 값으로 구문 분석합니다. |
Parse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider) |
UTF-8자의 범위를 값으로 구문 분석합니다. |
Parse(ReadOnlySpan<Char>, IFormatProvider) |
문자 범위를 값으로 구문 분석합니다. |
Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider) |
지정된 스타일 및 문화권별 지정 형식을 사용하여 숫자의 범위 표현을 해당하는 Decimal로 변환합니다. |
Parse(String) |
숫자의 문자열 표현을 해당하는 Decimal로 변환합니다. |
Parse(String, IFormatProvider) |
지정된 문화권별 형식 정보를 사용하여 숫자의 문자열 표현을 해당 Decimal로 변환합니다. |
Parse(String, NumberStyles) |
숫자를 지정된 스타일로 나타낸 문자열 표현을 해당 Decimal로 변환합니다. |
Parse(String, NumberStyles, IFormatProvider) |
지정된 스타일 및 문화권별 형식을 사용하여 숫자의 문자열 표현을 해당하는 Decimal로 변환합니다. |
Remainder(Decimal, Decimal) |
두 Decimal 값을 나눈 나머지를 계산합니다. |
Round(Decimal) |
10진 값을 가장 가까운 정수로 반올림합니다. |
Round(Decimal, Int32) |
Decimal 값을 지정된 소수 자릿수로 반올림합니다. |
Round(Decimal, Int32, MidpointRounding) |
지정된 반올림 전략을 사용하여 소수 값을 지정된 전체 자릿수로 반올림합니다. |
Round(Decimal, MidpointRounding) |
지정된 반올림 전략을 사용하여 10진수 값을 정수로 반올림합니다. |
Sign(Decimal) |
값의 기호를 계산합니다. |
Subtract(Decimal, Decimal) |
다른 값에서 지정된 Decimal 값을 뺍니다. |
ToByte(Decimal) |
지정된 Decimal의 값을 해당하는 8비트 부호 없는 정수로 변환합니다. |
ToDouble(Decimal) |
지정된 Decimal의 값을 해당하는 배정밀도 부동 소수점 숫자로 변환합니다. |
ToInt16(Decimal) |
지정된 Decimal의 값을 해당하는 16비트 부호 있는 정수로 변환합니다. |
ToInt32(Decimal) |
지정된 Decimal의 값을 해당하는 32비트 부호 있는 정수로 변환합니다. |
ToInt64(Decimal) |
지정된 Decimal의 값을 해당하는 64비트 부호 있는 정수로 변환합니다. |
ToOACurrency(Decimal) |
지정된 Decimal 값을 64비트 부호 있는 정수에 포함된 해당 OLE Automation Currency 값으로 변환합니다. |
ToSByte(Decimal) |
지정된 Decimal의 값을 해당하는 8비트 부호 있는 정수로 변환합니다. |
ToSingle(Decimal) |
지정된 Decimal의 값을 해당하는 단정밀도 부동 소수점 숫자로 변환합니다. |
ToString() |
이 인스턴스의 숫자 값을 해당하는 문자열 표현으로 변환합니다. |
ToString(IFormatProvider) |
지정된 문화권별 형식 정보를 사용하여 이 인스턴스의 숫자 값을 해당 문자열 표현으로 변환합니다. |
ToString(String) |
지정된 형식을 사용하여 이 인스턴스의 숫자 값을 해당 문자열 표현으로 변환합니다. |
ToString(String, IFormatProvider) |
지정된 형식 및 문화권별 형식 정보를 사용하여 이 인스턴스의 숫자 값을 해당 문자열 표현으로 변환합니다. |
ToUInt16(Decimal) |
지정된 Decimal의 값을 해당하는 16비트 부호 없는 정수로 변환합니다. |
ToUInt32(Decimal) |
지정된 Decimal의 값을 해당하는 32비트 부호 없는 정수로 변환합니다. |
ToUInt64(Decimal) |
지정된 Decimal의 값을 해당하는 64비트 부호 없는 정수로 변환합니다. |
Truncate(Decimal) |
소수 자리를 삭제하고 지정된 Decimal의 정수 자리만 반환합니다. |
TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider) |
현재 instance 값의 형식을 제공된 바이트 범위로 UTF-8로 지정하려고 시도합니다. |
TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider) |
현재의 10진수 인스턴스 값을 제공된 문자 범위의 형식으로 지정하려고 시도합니다. |
TryGetBits(Decimal, Span<Int32>, Int32) |
Decimal의 지정된 인스턴스 값을 동일한 이진 표현으로 변환합니다. |
TryParse(ReadOnlySpan<Byte>, Decimal) |
숫자의 문자열 표현을 포함하는 UTF-8 문자 범위를 부호 있는 10진수로 변환하려고 시도합니다. |
TryParse(ReadOnlySpan<Byte>, IFormatProvider, Decimal) |
UTF-8 문자의 범위를 값으로 구문 분석하려고 시도합니다. |
TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, Decimal) |
UTF-8 문자의 범위를 값으로 구문 분석하려고 시도합니다. |
TryParse(ReadOnlySpan<Char>, Decimal) |
지정된 스타일 및 문화권별 지정 형식을 사용하여 숫자의 범위 표현을 해당하는 Decimal로 변환합니다. 반환 값은 변환이 성공했는지 아니면 실패했는지를 나타냅니다. |
TryParse(ReadOnlySpan<Char>, IFormatProvider, Decimal) |
문자 범위를 값으로 구문 분석하려고 시도합니다. |
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, Decimal) |
지정된 스타일 및 문화권별 지정 형식을 사용하여 숫자의 범위 표현을 해당하는 Decimal로 변환합니다. 반환 값은 변환이 성공했는지 아니면 실패했는지를 나타냅니다. |
TryParse(String, Decimal) |
숫자의 문자열 표현을 해당하는 Decimal로 변환합니다. 반환 값은 변환이 성공했는지 아니면 실패했는지를 나타냅니다. |
TryParse(String, IFormatProvider, Decimal) |
문자열을 값으로 구문 분석하려고 합니다. |
TryParse(String, NumberStyles, IFormatProvider, Decimal) |
지정된 스타일 및 문화권별 형식을 사용하여 숫자의 문자열 표현을 해당하는 Decimal로 변환합니다. 반환 값은 변환이 성공했는지 아니면 실패했는지를 나타냅니다. |
연산자
Addition(Decimal, Decimal) |
지정된 두 Decimal 값을 더합니다. |
Decrement(Decimal) |
Decimal 피연산자를 1씩 감소시킵니다. |
Division(Decimal, Decimal) |
지정된 두 Decimal 값을 나눕니다. |
Equality(Decimal, Decimal) |
두 Decimal 값이 같은지 여부를 나타내는 값을 반환합니다. |
Explicit(Decimal to Byte) |
Decimal을 8비트 부호 없는 정수로 변환하는 명시적 변환을 정의합니다. |
Explicit(Decimal to Char) |
Decimal을 유니코드 문자로 변환하는 명시적 변환을 정의합니다. |
Explicit(Decimal to Double) |
Decimal을 배정밀도 부동 소수점 숫자로 변환하는 명시적 변환을 정의합니다. |
Explicit(Decimal to Int16) |
Decimal을 16비트 부호 있는 정수로 변환하는 명시적 변환을 정의합니다. |
Explicit(Decimal to Int32) |
Decimal을 32비트 부호 있는 정수로 변환하는 명시적 변환을 정의합니다. |
Explicit(Decimal to Int64) |
Decimal을 64비트 부호 있는 정수로 변환하는 명시적 변환을 정의합니다. |
Explicit(Decimal to SByte) |
Decimal을 8비트 부호 있는 정수로 변환하는 명시적 변환을 정의합니다. 이 API는 CLS 규격이 아닙니다. |
Explicit(Decimal to Single) |
Decimal을 단정밀도 부동 소수점 숫자로 변환하는 명시적 변환을 정의합니다. |
Explicit(Decimal to UInt16) |
Decimal을 16비트 부호 없는 정수로 변환하는 명시적 변환을 정의합니다. 이 API는 CLS 규격이 아닙니다. |
Explicit(Decimal to UInt32) |
Decimal을 32비트 부호 없는 정수로 변환하는 명시적 변환을 정의합니다. 이 API는 CLS 규격이 아닙니다. |
Explicit(Decimal to UInt64) |
Decimal을 64비트 부호 없는 정수로 변환하는 명시적 변환을 정의합니다. 이 API는 CLS 규격이 아닙니다. |
Explicit(Double to Decimal) |
배정밀도 부동 소수점 숫자를 Decimal로 변환하는 명시적 변환을 정의합니다. |
Explicit(Single to Decimal) |
단정밀도 부동 소수점 숫자를 Decimal로 변환하는 명시적 변환을 정의합니다. |
GreaterThan(Decimal, Decimal) | |
GreaterThanOrEqual(Decimal, Decimal) | |
Implicit(Byte to Decimal) |
8비트 부호 없는 정수를 Decimal로 변환하는 명시적 변환을 정의합니다. |
Implicit(Char to Decimal) |
유니코드 문자를 Decimal로 변환하는 암시적 변환을 정의합니다. |
Implicit(Int16 to Decimal) |
16비트 부호 있는 정수를 Decimal로 변환하는 암시적 변환을 정의합니다. |
Implicit(Int32 to Decimal) |
32비트 부호 있는 정수를 Decimal로 변환하는 암시적 변환을 정의합니다. |
Implicit(Int64 to Decimal) |
64비트 부호 있는 정수를 Decimal로 변환하는 암시적 변환을 정의합니다. |
Implicit(SByte to Decimal) |
부호 있는 8비트 정수를 Decimal 값으로 변환하는 암시적 변환을 정의합니다. 이 API는 CLS 규격이 아닙니다. |
Implicit(UInt16 to Decimal) |
부호 없는 16비트 정수를 Decimal로 변환하는 암시적 변환을 정의합니다. 이 API는 CLS 규격이 아닙니다. |
Implicit(UInt32 to Decimal) |
부호 없는 32비트 정수를 Decimal로 변환하는 암시적 변환을 정의합니다. 이 API는 CLS 규격이 아닙니다. |
Implicit(UInt64 to Decimal) |
부호 없는 64비트 정수를 Decimal로 변환하는 암시적 변환을 정의합니다. 이 API는 CLS 규격이 아닙니다. |
Increment(Decimal) |
Decimal 피연산자를 1씩 증가시킵니다. |
Inequality(Decimal, Decimal) |
두 Decimal 개체의 값이 다른지 여부를 나타내는 값을 반환합니다. |
LessThan(Decimal, Decimal) | |
LessThanOrEqual(Decimal, Decimal) | |
Modulus(Decimal, Decimal) |
지정된 두 Decimal 값을 나눈 나머지를 반환합니다. |
Multiply(Decimal, Decimal) |
지정된 두 Decimal 값을 곱합니다. |
Subtraction(Decimal, Decimal) |
지정된 두 Decimal 값을 뺍니다. |
UnaryNegation(Decimal) |
지정된 Decimal 피연산자 값의 부정입니다. |
UnaryPlus(Decimal) |
Decimal 피연산자의 값을 반환합니다(피연산자의 부호는 변경되지 않음). |
명시적 인터페이스 구현
적용 대상
스레드 보안
이 형식의 모든 멤버는 스레드로부터 안전합니다. instance 상태를 수정하는 것처럼 보이는 멤버는 실제로 새 값으로 초기화된 새 instance 반환합니다. 다른 형식과 마찬가지로 이 형식의 instance 포함된 공유 변수를 읽고 쓰는 것은 스레드 안전을 보장하기 위해 잠금으로 보호되어야 합니다.
추가 정보
피드백
다음에 대한 사용자 의견 제출 및 보기