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 の範囲の 10 進数を表します 335 からマイナス 79,228,162,514,264,337,593,543,950,335。 の既定値 Decimal
は 0 です。 値の型は Decimal 、整数と小数部の数字が多く、丸め誤差が発生しない財務計算に適しています。 型を Decimal 使用しても、丸め処理は不要です。 丸めに起因するエラーが最小限に抑えられます。 たとえば、次のコードでは、0.9999999999999999999999999999999999999 の結果が生成されます。
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 ビットのフラグセットです。 したがって、形式の値の Decimal バイナリ表現 ((-296 から 296) / 10(0 から 28))、-(296-1) は と等しく MinValue、296-1 は と MaxValue等しくなります。 値のバイナリ表現と例のDecimal詳細については、コンストラクターと メソッドに関するページをGetBitsDecimal(Int32[])参照してください。
また、スケーリング係数は、末尾のゼロを数値で Decimal 保持します。 後続のゼロは、算術演算または比較演算の数値の値 Decimal には影響しません。 ただし、適切な書式指定文字列が適用されている場合は、 ToString メソッドによって末尾のゼロが表示される場合があります。
変換に関する考慮事項
この型は、および の値とのInt32ByteUInt32SByteInt16Int64UInt16間で値を変換Decimalするメソッドを提供します。UInt64 これらの整数型から への Decimal 変換は、情報を失ったり例外をスローしたりしない拡大変換です。
から Decimal 整数型への変換では、値を 0 に最も近い整数値に丸 Decimal める変換が縮小されています。 C# などの一部の言語では、値から Decimal 値への Char 変換もサポートされています。 これらの変換の結果を変換先の型で表すことができない場合は、 OverflowException 例外がスローされます。
型にはDecimal、値を および 値との間で変換DecimalするSingleDoubleメソッドも用意されています。 から Decimal または Double へのSingle変換は、変換された値の大きさに関する情報ではなく、精度を失う可能性がある縮小変換です。 変換では例外はスローされません。
変換の結果を Decimal として表すことができない場合は、 または Double からのSingle変換で例外がDecimalスローOverflowExceptionされます。
10 進数の値に対する操作の実行
型は Decimal 、加算、減算、除算、乗算、単項否定などの標準的な算術演算をサポートしています。 メソッドを呼び出GetBitsすことで、値のバイナリ表現をDecimal直接操作することもできます。
2 つのDecimal値を比較するには、標準の数値比較演算子を使用するか、 メソッドまたは Equals メソッドをCompareTo呼び出します。
クラスのメンバーを呼び出して、数値の Math 絶対値の取得、2 つの 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 |
10 進数の小数点以下桁数を表す 0 ~ 28 の数値を取得します。 |
メソッド
Abs(Decimal) |
値の絶対を計算します。 |
Add(Decimal, Decimal) |
指定した 2 つの Decimal 値を加算します。 |
Ceiling(Decimal) |
指定した 10 進数以上の数のうち、最小の整数値を返します。 |
Clamp(Decimal, Decimal, Decimal) |
値を包括的な最小値と最大値にクランプします。 |
Compare(Decimal, Decimal) |
2 つの指定した Decimal 値を比較します。 |
CompareTo(Decimal) |
指定した Decimal オブジェクトとこのインスタンスを比較し、これらの相対値の比較を返します。 |
CompareTo(Object) |
指定したオブジェクトとこのインスタンスを比較し、これらの相対値の比較を返します。 |
CopySign(Decimal, Decimal) |
値の符号を別の値の符号にコピーします。 |
CreateChecked<TOther>(TOther) |
現在の型のインスタンスを値から作成し、現在の型の表現可能な範囲外の値に対してオーバーフロー例外をスローします。 |
CreateSaturating<TOther>(TOther) |
現在の型のインスタンスを値から作成し、現在の型の表現可能な範囲外の値を飽和させます。 |
CreateTruncating<TOther>(TOther) |
現在の型のインスタンスを値から作成し、現在の型の表現可能な範囲外の値を切り捨てます。 |
Divide(Decimal, Decimal) |
2 つの指定した Decimal 値を除算します。 |
Equals(Decimal) |
このインスタンスと指定した Decimal オブジェクトが同じ値を表しているかどうかを示す値を返します。 |
Equals(Decimal, Decimal) |
Decimal の指定された 2 つのインスタンスが同じ値を表しているかどうかを示す値を返します。 |
Equals(Object) |
このインスタンスと指定した Object が同じ型と値を表しているかどうかを示す値を返します。 |
Floor(Decimal) |
指定した Decimal 数を、負の無限大方向の近似整数に丸めます。 |
FromOACurrency(Int64) |
OLE オートメーション通貨値を格納している指定した 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) |
2 つの値を、より大きいコンピューティングと比較します。 |
MaxMagnitude(Decimal, Decimal) |
2 つの値を、より大きいコンピューティングと比較します。 |
Min(Decimal, Decimal) |
2 つの値を比較して計算します。この値は小さくなります。 |
MinMagnitude(Decimal, Decimal) |
2 つの値を比較して計算します。この値は小さくなります。 |
Multiply(Decimal, Decimal) |
指定された 2 つの 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) |
2 つの Decimal 値の除算後の剰余を計算します。 |
Round(Decimal) |
10 進値を最も近い整数に丸めます。 |
Round(Decimal, Int32) |
Decimal 値を、指定した小数点以下の桁数に丸めます。 |
Round(Decimal, Int32, MidpointRounding) |
指定した丸め方法を使用して、指定した精度に 10 進値を丸めます。 |
Round(Decimal, MidpointRounding) |
指定した丸め方法を使用して、10 進数の値を整数に丸めます。 |
Sign(Decimal) |
値の符号を計算します。 |
Subtract(Decimal, Decimal) |
指定した Decimal 値から、指定したもう 1 つの値を減算します。 |
ToByte(Decimal) |
指定した Decimal の値を、等価の 8 ビット符号なし整数に変換します。 |
ToDouble(Decimal) |
指定した Decimal の値を、それと等価の倍精度浮動小数点数に変換します。 |
ToInt16(Decimal) |
指定した Decimal の値を、等価の 16 ビット符号付き整数に変換します。 |
ToInt32(Decimal) |
指定した Decimal の値を、等価の 32 ビット符号付き整数に変換します。 |
ToInt64(Decimal) |
指定した Decimal の値を、等価の 64 ビット符号付き整数に変換します。 |
ToOACurrency(Decimal) |
指定した Decimal 値を、64 ビット符号付き整数に格納されるそれと等価の OLE オートメーション通貨値に変換します。 |
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) |
現在のインスタンスの値を 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 に変換します。 戻り値は変換が成功したか失敗したかを示します。 |
演算子
明示的なインターフェイスの実装
適用対象
スレッド セーフ
この型のすべてのメンバーはスレッド セーフです。 インスタンスの状態を変更するように見えるメンバーは、実際には新しい値で初期化された新しいインスタンスを返します。 他の型と同様に、この型のインスタンスを含む共有変数の読み取りと書き込みは、スレッドの安全性を保証するためにロックによって保護する必要があります。
こちらもご覧ください
フィードバック
フィードバックの送信と表示