Convert.ToDouble Method (Single)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Converts the value of the specified single-precision floating-point number to an equivalent double-precision floating-point number.

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

Public Shared Function ToDouble (
	value As Single
) As Double

Parameters

value
Type: System.Single

The single-precision floating-point number.

Return Value

Type: System.Double

A double-precision floating-point number that is equivalent to value.

The following example converts a Single value to a Double value.

Public Sub CovertDoubleFloat(ByVal doubleVal As Double)
    Dim singleVal As Single = 0

    ' Double to Single conversion cannot overflow.
        singleVal = System.Convert.ToSingle(doubleVal)
        System.Console.WriteLine("{0} as a Single is {1}", _
                                  doubleVal, singleVal)

    ' Conversion from Single to Double cannot overflow.
    doubleVal = System.Convert.ToDouble(singleVal)
    System.Console.WriteLine("{0} as a Double is: {1}", _
                              singleVal, doubleVal)
End Sub

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: