
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
BitConverter.DoubleToInt64Bits() Method in C#
The BitConverter.DoubleToInt64Bits() method in C# is used to convert the specified double-precision floating-point number to a 64-bit signed integer.
Syntax
Following is the syntax −
public static long DoubleToInt64Bits (double val);
Above, Val is the number to convert.
Example
Let us now see an example to implement the BitConverter.DoubleToInt64Bits() method −
using System; public class Demo { public static void Main(){ double d = 5.646587687; Console.Write("Value = "+d); long res = BitConverter.DoubleToInt64Bits(d); Console.Write("
64-bit signed integer = "+res); } }
Output
This will produce the following output −
Value = 5.646587687 64-bit signed integer = 4618043510978159912
Example
Let us see another example −
using System; public class Demo { public static void Main(){ double d = 0.001; Console.Write("Value = "+d); long res = BitConverter.DoubleToInt64Bits(d); Console.Write("
64-bit signed integer = "+res); } }
Output
This will produce the following output −
Value = 0.001 64-bit signed integer = 4562254508917369340
Advertisements