BitConverter.Int64BitsToDouble(Int64) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Reinterpreta il valore intero con segno a 64 bit specificato in un numero in virgola mobile e precisione doppia.
public:
static double Int64BitsToDouble(long value);
public static double Int64BitsToDouble (long value);
static member Int64BitsToDouble : int64 -> double
Public Shared Function Int64BitsToDouble (value As Long) As Double
Parametri
- value
- Int64
Numero da convertire.
Restituisce
Numero in virgola mobile e precisione doppia il cui valore è equivalente a value
.
Esempio
Nell'esempio di codice seguente vengono convertiti i modelli di bit di diversi Int64 valori in Double valori con il Int64BitsToDouble
metodo .
// Example of the BitConverter::Int64BitsToDouble method.
using namespace System;
// Reinterpret the __int64 argument as a double.
void LongBitsToDouble( __int64 argument )
{
double doubleValue;
doubleValue = BitConverter::Int64BitsToDouble( argument );
// Display the argument in hexadecimal.
Console::WriteLine( "{0,20}{1,27:E16}", String::Format( "0x{0:X16}", argument ), doubleValue );
}
int main()
{
Console::WriteLine( "This example of the BitConverter::Int64BitsToDouble( "
"__int64 ) \nmethod generates the following output.\n" );
Console::WriteLine( "{0,20}{1,27:E16}", "__int64 argument", "double value" );
Console::WriteLine( "{0,20}{1,27:E16}", "----------------", "------------" );
// Convert __int64 values and display the results.
LongBitsToDouble( 0 );
LongBitsToDouble( 0x3FF0000000000000 );
LongBitsToDouble( 0x402E000000000000 );
LongBitsToDouble( 0x406FE00000000000 );
LongBitsToDouble( 0x41EFFFFFFFE00000 );
LongBitsToDouble( 0x3F70000000000000 );
LongBitsToDouble( 0x3DF0000000000000 );
LongBitsToDouble( 0x0000000000000001 );
LongBitsToDouble( 0x000000000000FFFF );
LongBitsToDouble( 0x0000FFFFFFFFFFFF );
LongBitsToDouble( 0xFFFFFFFFFFFFFFFF );
LongBitsToDouble( 0xFFF0000000000000 );
LongBitsToDouble( 0x7FF0000000000000 );
LongBitsToDouble( 0xFFEFFFFFFFFFFFFF );
LongBitsToDouble( 0x7FEFFFFFFFFFFFFF );
LongBitsToDouble( Int64::MinValue );
LongBitsToDouble( Int64::MaxValue );
}
/*
This example of the BitConverter::Int64BitsToDouble( __int64 )
method generates the following output.
__int64 argument double value
---------------- ------------
0x0000000000000000 0.0000000000000000E+000
0x3FF0000000000000 1.0000000000000000E+000
0x402E000000000000 1.5000000000000000E+001
0x406FE00000000000 2.5500000000000000E+002
0x41EFFFFFFFE00000 4.2949672950000000E+009
0x3F70000000000000 3.9062500000000000E-003
0x3DF0000000000000 2.3283064365386963E-010
0x0000000000000001 4.9406564584124654E-324
0x000000000000FFFF 3.2378592100206092E-319
0x0000FFFFFFFFFFFF 1.3906711615669959E-309
0xFFFFFFFFFFFFFFFF NaN
0xFFF0000000000000 -Infinity
0x7FF0000000000000 Infinity
0xFFEFFFFFFFFFFFFF -1.7976931348623157E+308
0x7FEFFFFFFFFFFFFF 1.7976931348623157E+308
0x8000000000000000 0.0000000000000000E+000
0x7FFFFFFFFFFFFFFF NaN
*/
// Example of the BitConverter.Int64BitsToDouble method.
using System;
class Int64BitsToDoubleDemo
{
const string formatter = "{0,20}{1,27:E16}";
// Reinterpret the long argument as a double.
public static void LongBitsToDouble( long argument )
{
double doubleValue;
doubleValue = BitConverter.Int64BitsToDouble( argument );
// Display the argument in hexadecimal.
Console.WriteLine( formatter,
string.Format( "0x{0:X16}", argument ), doubleValue );
}
public static void Main( )
{
Console.WriteLine(
"This example of the BitConverter.Int64BitsToDouble( " +
"long ) \nmethod generates the following output.\n" );
Console.WriteLine( formatter, "long argument",
"double value" );
Console.WriteLine( formatter, "-------------",
"------------" );
// Convert long values and display the results.
LongBitsToDouble( 0 );
LongBitsToDouble( 0x3FF0000000000000 );
LongBitsToDouble( 0x402E000000000000 );
LongBitsToDouble( 0x406FE00000000000 );
LongBitsToDouble( 0x41EFFFFFFFE00000 );
LongBitsToDouble( 0x3F70000000000000 );
LongBitsToDouble( 0x3DF0000000000000 );
LongBitsToDouble( 0x0000000000000001 );
LongBitsToDouble( 0x000000000000FFFF );
LongBitsToDouble( 0x0000FFFFFFFFFFFF );
LongBitsToDouble( unchecked( (long)0xFFFFFFFFFFFFFFFF ) );
LongBitsToDouble( unchecked( (long)0xFFF0000000000000 ) );
LongBitsToDouble( 0x7FF0000000000000 );
LongBitsToDouble( unchecked( (long)0xFFEFFFFFFFFFFFFF ) );
LongBitsToDouble( 0x7FEFFFFFFFFFFFFF );
LongBitsToDouble( long.MinValue );
LongBitsToDouble( long.MaxValue );
}
}
/*
This example of the BitConverter.Int64BitsToDouble( long )
method generates the following output.
long argument double value
------------- ------------
0x0000000000000000 0.0000000000000000E+000
0x3FF0000000000000 1.0000000000000000E+000
0x402E000000000000 1.5000000000000000E+001
0x406FE00000000000 2.5500000000000000E+002
0x41EFFFFFFFE00000 4.2949672950000000E+009
0x3F70000000000000 3.9062500000000000E-003
0x3DF0000000000000 2.3283064365386963E-010
0x0000000000000001 4.9406564584124654E-324
0x000000000000FFFF 3.2378592100206092E-319
0x0000FFFFFFFFFFFF 1.3906711615669959E-309
0xFFFFFFFFFFFFFFFF NaN
0xFFF0000000000000 -Infinity
0x7FF0000000000000 Infinity
0xFFEFFFFFFFFFFFFF -1.7976931348623157E+308
0x7FEFFFFFFFFFFFFF 1.7976931348623157E+308
0x8000000000000000 0.0000000000000000E+000
0x7FFFFFFFFFFFFFFF NaN
*/
open System
let print obj1 obj2 =
printfn $"{obj1,20}{obj2,27:E16}"
// Reinterpret the long argument as a double.
let longBitsToDouble argument =
let doubleValue = BitConverter.Int64BitsToDouble argument
// Display the argument in hexadecimal.
print (String.Format("0x{0:X16}", argument)) doubleValue
printfn "This example of the BitConverter.Int64BitsToDouble(Int64) \nmethod generates the following output.\n"
print "long argument" "double value"
print "-------------" "------------"
// Convert long values and display the results.
longBitsToDouble 0
longBitsToDouble 0x3FF0000000000000L
longBitsToDouble 0x402E000000000000L
longBitsToDouble 0x406FE00000000000L
longBitsToDouble 0x41EFFFFFFFE00000L
longBitsToDouble 0x3F70000000000000L
longBitsToDouble 0x3DF0000000000000L
longBitsToDouble 0x0000000000000001L
longBitsToDouble 0x000000000000FFFFL
longBitsToDouble 0x0000FFFFFFFFFFFFL
longBitsToDouble 0xFFFFFFFFFFFFFFFFL
longBitsToDouble 0xFFF0000000000000L
longBitsToDouble 0x7FF0000000000000L
longBitsToDouble 0xFFEFFFFFFFFFFFFFL
longBitsToDouble 0x7FEFFFFFFFFFFFFFL
longBitsToDouble Int64.MinValue
longBitsToDouble Int64.MaxValue
// This example of the BitConverter.Int64BitsToDouble( long )
// method generates the following output.
// long argument double value
// ------------- ------------
// 0x0000000000000000 0.0000000000000000E+000
// 0x3FF0000000000000 1.0000000000000000E+000
// 0x402E000000000000 1.5000000000000000E+001
// 0x406FE00000000000 2.5500000000000000E+002
// 0x41EFFFFFFFE00000 4.2949672950000000E+009
// 0x3F70000000000000 3.9062500000000000E-003
// 0x3DF0000000000000 2.3283064365386963E-010
// 0x0000000000000001 4.9406564584124654E-324
// 0x000000000000FFFF 3.2378592100206092E-319
// 0x0000FFFFFFFFFFFF 1.3906711615669959E-309
// 0xFFFFFFFFFFFFFFFF NaN
// 0xFFF0000000000000 -∞
// 0x7FF0000000000000 ∞
// 0xFFEFFFFFFFFFFFFF -1.7976931348623157E+308
// 0x7FEFFFFFFFFFFFFF 1.7976931348623157E+308
// 0x8000000000000000 0.0000000000000000E+000
// 0x7FFFFFFFFFFFFFFF NaN
' Example of the BitConverter.Int64BitsToDouble method.
Module Int64BitsToDoubleDemo
Const formatter As String = "{0,20}{1,27:E16}"
' Reinterpret the Long argument as a Double.
Sub LongBitsToDouble( argument As Long )
Dim doubleValue As Double
doubleValue = BitConverter.Int64BitsToDouble( argument )
' Display the argument in hexadecimal.
Console.WriteLine( formatter, _
String.Format( "0x{0:X16}", argument ), doubleValue )
End Sub
Sub Main( )
Console.WriteLine( _
"This example of the BitConverter.Int64BitsToDouble( " & _
"Long ) " & vbCrLf & "method generates the " & _
"following output." & vbCrLf )
Console.WriteLine( formatter, "Long argument", _
"Double value" )
Console.WriteLine( formatter, "-------------", _
"------------" )
' Convert Long values and display the results.
LongBitsToDouble( 0 )
LongBitsToDouble( &H3FF0000000000000 )
LongBitsToDouble( &H402E000000000000 )
LongBitsToDouble( &H406FE00000000000 )
LongBitsToDouble( &H41EFFFFFFFE00000 )
LongBitsToDouble( &H3F70000000000000 )
LongBitsToDouble( &H3DF0000000000000 )
LongBitsToDouble( &H0000000000000001 )
LongBitsToDouble( &H000000000000FFFF )
LongBitsToDouble( &H0000FFFFFFFFFFFF )
LongBitsToDouble( &HFFFFFFFFFFFFFFFF )
LongBitsToDouble( &HFFF0000000000000 )
LongBitsToDouble( &H7FF0000000000000 )
LongBitsToDouble( &HFFEFFFFFFFFFFFFF )
LongBitsToDouble( &H7FEFFFFFFFFFFFFF )
LongBitsToDouble( Long.MinValue )
LongBitsToDouble( Long.MaxValue )
End Sub
End Module
' This example of the BitConverter.Int64BitsToDouble( Long )
' method generates the following output.
'
' Long argument Double value
' ------------- ------------
' 0x0000000000000000 0.0000000000000000E+000
' 0x3FF0000000000000 1.0000000000000000E+000
' 0x402E000000000000 1.5000000000000000E+001
' 0x406FE00000000000 2.5500000000000000E+002
' 0x41EFFFFFFFE00000 4.2949672950000000E+009
' 0x3F70000000000000 3.9062500000000000E-003
' 0x3DF0000000000000 2.3283064365386963E-010
' 0x0000000000000001 4.9406564584124654E-324
' 0x000000000000FFFF 3.2378592100206092E-319
' 0x0000FFFFFFFFFFFF 1.3906711615669959E-309
' 0xFFFFFFFFFFFFFFFF NaN
' 0xFFF0000000000000 -Infinity
' 0x7FF0000000000000 Infinity
' 0xFFEFFFFFFFFFFFFF -1.7976931348623157E+308
' 0x7FEFFFFFFFFFFFFF 1.7976931348623157E+308
' 0x8000000000000000 0.0000000000000000E+000
' 0x7FFFFFFFFFFFFFFF NaN
Commenti
In genere, value
è un intero restituito dal DoubleToInt64Bits metodo .