by cozzyd · 11y ago · 0 comments
uint64_t e = (1023-mj) << 52;
double exp = *((double*) &e)
edit: Whether or not there's a way to express that in Scala, I don't know...http://www.tutorialspoint.com/scala/scala_bitwise_operators....
So the "<<" is easy enough to cover.
I do not know what the * is going, if it involves pointer something something then it may not be possible to replicate.
I don't know how that would get optimized by the jit at runtime though.
http://docs.oracle.com/javase/7/docs/api/java/lang/Double.ht...
http://docs.oracle.com/javase/7/docs/api/java/lang/Double.ht...
Both are marked as native functions in OpenJDK 7:
http://grepcode.com/file/repository.grepcode.com/java/root/j...
http://grepcode.com/file/repository.grepcode.com/java/root/j...