Mega Code Archive

 
Categories / C# / Data Types
 

Converts Decimal to the equivalent single-precision floating-point number

using System; class MainClass {     public static void DecimalToSgl_Dbl( decimal argument )     {         object SingleValue;         object DoubleValue;         SingleValue = decimal.ToSingle( argument );         DoubleValue = decimal.ToDouble( argument );         Console.WriteLine( SingleValue );         Console.WriteLine( DoubleValue );     }     public static void Main( )     {         DecimalToSgl_Dbl( 123M );     } }