Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

decimal: practical reference

decimal: practical reference: decimal is a 128-bit base-10 numeric type with high decimal precision.

Version: C# built-in type reference; .NET 10 runtime

Syntax

decimal value

decimal is a 128-bit base-10 numeric type with high decimal precision.

Use it for money and calculations requiring predictable decimal fractions.

It has less range and slower operations than double and represents neither NaN nor infinity.

Overflow can always throw, while scale affects representation and rounding.

The complete program actually uses decimal; its exact expected stdout is System.Decimal.

Examples

using System;

Console.WriteLine(typeof(decimal).FullName);

Result

System.Decimal

The complete program actually uses `decimal`; its exact expected stdout is `System.Decimal`.

Sources