Mega Code Archive

 
Categories / VB.Net / Data Types
 

Converts a single-precision floating-point number to a Decimal

Imports System Imports Microsoft.VisualBasic Module DecimalFromSingleDemo     Sub DecimalFromSingle( argument As Single )         Dim decValue    As Object         ' Convert the Single argument to a Decimal value.         Try             decValue = Decimal.op_Explicit( argument )         Catch ex As Exception             Console.WriteLine(ex)         End Try         ' Display the Decimal.         Console.WriteLine(decValue)     End Sub      Sub Main( )         DecimalFromSingle( 1.2345E-30 )     End Sub  End Module