C#의 BitConverter.DoubleToInt64Bits() 메서드는 지정된 배정밀도 부동 소수점 숫자를 64비트 부호 있는 정수로 변환하는 데 사용됩니다.
구문
다음은 구문입니다 -
public static long DoubleToInt64Bits (double val);
위의 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