VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > temp > C#教程 >
  • C# | BitConverter。Int64BitsToDouble()方法

C# | BitConverter。Int64BitsToDouble()方法

原文:https://www . geesforgeks . org/c-sharp-bit converter-int 64 bitstodouble-method/

BitConverter。Int64BitsToDouble(Int64)方法用于将指定的 64 位有符号整数转换为双精度浮点数。

语法:

public static double Int64BitsToDouble (long value);

参数:该方法以 64 位有符号整数为参数。

返回值:该方法返回一个双精度浮点数,其值相当于

以下程序说明了位转换器的使用。Int64BitsToDouble(Int64) 方法:

例 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

例 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

参考:

  • https://docs . Microsoft . com/en-us/dotnet/API/system . bit converter . int 64 bitstodouble?视图=netframework-4.7.2


相关教程