C# | BitConverter.Int64BitsToDouble() Method
Last Updated :
01 Feb, 2019
BitConverter.Int64BitsToDouble(Int64) Method is used to convert the specified 64-bit signed integer to a double-precision floating point number.
Syntax:
public static double Int64BitsToDouble (long value);
Parameters: This method takes the 64-bit signed integer value as a parameter.
Return Value: This method returns a double-precision floating point number whose value is equivalent to value.
Below programs illustrate the use of BitConverter.Int64BitsToDouble(Int64) Method:
Example 1:
using System;
public class GFG {
public static void Main()
{
long value = 214748364;
Console.Write( "64-bit signed integer: " );
Console.WriteLine( "{0}" , value);
Console.WriteLine();
double value1 = BitConverter.Int64BitsToDouble(value);
Console.Write( "double-precision floating point number: " );
Console.WriteLine( "{0}" , value1);
}
}
|
Output:
64-bit signed integer: 214748364
double-precision floating point number: 1.06099789153011E-315
Example 2:
using System;
using System.Collections.Generic;
public class GFG {
public static void Main()
{
long value = 1;
Console.Write( "64-bit signed integer: " );
Console.WriteLine( "{0}" , value);
Console.WriteLine();
double value1 = BitConverter.Int64BitsToDouble(value);
Console.Write( "double-precision floating point number: " );
Console.WriteLine( "{0}" , value1);
}
}
|
Output:
64-bit signed integer: 1
double-precision floating point number: 4.94065645841247E-324
Reference:
Share your thoughts in the comments
Please Login to comment...