# Decimal Narrowing Conversion (Decimal to Single)

.NET Framework 4.5

Defines an explicit conversion of a Decimal to a single-precision floating-point number.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

## Syntax

```'Declaration
Public Shared Narrowing Operator CType ( _
value As Decimal _
) As Single
```

#### Parameters

value
Type: System.Decimal

The value to convert.

#### Return Value

Type: System.Single
A single-precision floating-point number that represents the converted Decimal.

## Remarks

This operation can result in a loss of precision, because a single-precision floating-point number has fewer significant digits than a Decimal.

This operator supports the explicit conversion of a Decimal to a Single. The syntax for such explicit conversions is language-dependent, and individual language compilers can provide different implementations and return different results. The example illustrates the different return values when you explicitly convert a Decimal value to a Single value by using C# and Visual Basic. To perform a conversion that is independent of language, you can call the ToSingle or the Convert.ToSingle(Decimal) method.

## Examples

The following example converts Decimal numbers to Single values by using the explicit Decimal to Single conversion.

```Module Example
Public Sub Main( )
' Define an array of Decimal values.
Dim values() As Decimal= { 0.0000000000000000000000000001d,
0.0000000000123456789123456789d,
123d,
New Decimal(123000000, 0, 0, False, 6),
123456789.123456789d,
123456789123456789123456789d,
Decimal.MinValue, Decimal.MaxValue }
For Each value In values
Dim dblValue As Single = CSng(value)
Console.WriteLine("{0} ({1}) --> {2} ({3})", value,
value.GetType().Name, dblValue,
dblValue.GetType().Name)
Next
End Sub
End Module
' The example displays the following output:
'    0.0000000000000000000000000001 (Decimal) --> 1E-28 (Single)
'    0.0000000000123456789123456789 (Decimal) --> 1.234568E-11 (Single)
'    123 (Decimal) --> 123 (Single)
'    123.000000 (Decimal) --> 123 (Single)
'    123456789.123456789 (Decimal) --> 1.234568E+08 (Single)
'    123456789123456789123456789 (Decimal) --> 1.234568E+26 (Single)
'    -79228162514264337593543950335 (Decimal) --> -7.922816E+28 (Single)
'    79228162514264337593543950335 (Decimal) --> 7.922816E+28 (Single)
```

## Version Information

#### .NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

#### .NET Framework Client Profile

Supported in: 4, 3.5 SP1

#### Portable Class Library

Supported in: Portable Class Library

#### .NET for Windows Store apps

Supported in: Windows 8

#### .NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

## Platforms

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.