
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Convert the specified double-precision floating point number to a 64-bit signed integer in C#
To convert the specified double-precision floating point number to a 64-bit signed integer, the code is as follows −
Example
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
- Related Articles
- Reinterpret 64-bit signed integer to a double-precision floating point number in C#
- Implicit conversion from 64-bit signed integer (long) to Decimal in C#
- Return the total elements in a sequence as a 64-bit signed integer in C#
- Convert Decimal to the equivalent 64-bit unsigned integer in C#
- Signed floating point numbers
- Convert a floating point number to string in C
- How to deal with floating point number precision in JavaScript?
- What is the precision of floating point in C++?
- Convert the value of the specified Decimal to the equivalent 16-bit unsigned integer in C#
- Implicit conversion from 8-bit signed integer (SByte) to Decimal in C#
- Haskell Program to convert the string into a floating-point number
- How to convert a string to a floating point number in JavaScript?
- Integer literals vs Floating point literals in C#
- Convert Double to Integer in Java
- Precision of floating point numbers in C++ (floor(), ceil(), trunc(), round() and setprecision())

Advertisements