C# | BitConverter.Int64BitsToDouble() Method
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); } } |
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); } } |
64-bit signed integer: 1 double-precision floating point number: 4.94065645841247E-324
Reference:
Recommended Posts:
- Difference between Method Overriding and Method Hiding in C#
- C# | IndexOfAny() Method
- C# | ToUpper() Method
- C# | Copy() Method
- C# | ToLower() Method
- DateTime.Add() Method in C#
- C# | Uri.IsBaseOf(Uri) Method
- C# | SortedDictionary.Add() Method
- C# | Trim() Method
- C# | CopyTo() Method
- C# | Uri.IsWellFormedOriginalString() Method
- C# | Uri.ToString() Method
- C# | Random.Next() Method
- C# | Math.Pow() Method
- C# | Uri.IsHexDigit() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



