Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Double.doubleToLongBits equivalent in C#?

there's a Java method Double.doubleToLongBits that basically gets a double and return a long with the same bits.
How can I do it in C#?
Thank you

like image 661
Mark Segal Avatar asked Jul 25 '11 13:07

Mark Segal


2 Answers

BitConverter.DoubleToInt64Bits would be a good alternative.

http://msdn.microsoft.com/en-us/library/system.bitconverter.doubletoint64bits.aspx

like image 165
JK. Avatar answered Nov 07 '22 03:11

JK.


You'll want BitConverter.DoubleToInt64Bits

like image 40
Sean Avatar answered Nov 07 '22 04:11

Sean