Skip to content
Related Articles

Related Articles

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:




// C# program to demonstrate
// BitConverter.Int64BitsToDouble(Int64)
// Method
using System;
  
public class GFG {
  
    // Main Method
    public static void Main()
    {
  
        // declaring and initializing 
        // double value
        long value = 214748364;
  
        // Display the double value
        Console.Write("64-bit signed integer: ");
        Console.WriteLine("{0}", value);
        Console.WriteLine();
  
        // Converting double to long value
        // using BitConverter.DoubleToInt64Bits()
        // Method
        double value1 = BitConverter.Int64BitsToDouble(value);
  
        // Display the 64-bit signed integer.
        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:




// C# program to demonstrate
// BitConverter.Int64BitsToDouble(Int64)
// Method
using System;
using System.Collections.Generic;
  
public class GFG {
  
    // Main Method
    public static void Main()
    {
        // declaring and initializing
        // double value
        long value = 1;
  
        // Display the double value
        Console.Write("64-bit signed integer: ");
        Console.WriteLine("{0}", value);
        Console.WriteLine();
  
        // Converting double to long value
        // using BitConverter.DoubleToInt64Bits()
        // Method
        double value1 = BitConverter.Int64BitsToDouble(value);
  
        // Display the 64-bit signed integer.
        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:

My Personal Notes arrow_drop_up
Recommended Articles
Page :