C# में BitConverter.DoubleToInt64Bits() विधि का उपयोग निर्दिष्ट डबल-सटीक फ़्लोटिंग-पॉइंट नंबर को 64-बिट हस्ताक्षरित पूर्णांक में बदलने के लिए किया जाता है।
सिंटैक्स
निम्नलिखित वाक्य रचना है -
public static long DoubleToInt64Bits (double val);
ऊपर, वैल कन्वर्ट करने की संख्या है।
उदाहरण
आइए अब BitConverter.DoubleToInt64Bits() विधि को लागू करने के लिए एक उदाहरण देखें -
using System;
public class Demo {
public static void Main(){
double d = 5.646587687;
Console.Write("Value = "+d);
long res = BitConverter.DoubleToInt64Bits(d);
Console.Write("\n64-bit signed integer = "+res);
}
} आउटपुट
यह निम्नलिखित आउटपुट उत्पन्न करेगा -
Value = 5.646587687 64-bit signed integer = 4618043510978159912
उदाहरण
आइए एक और उदाहरण देखें -
using System;
public class Demo {
public static void Main(){
double d = 0.001;
Console.Write("Value = "+d);
long res = BitConverter.DoubleToInt64Bits(d);
Console.Write("\n64-bit signed integer = "+res);
}
} आउटपुट
यह निम्नलिखित आउटपुट उत्पन्न करेगा -
Value = 0.001 64-bit signed integer = 4562254508917369340