Why is the Java statement ```public static final l...
# compiler
m
Why is the Java statement
Copy code
public static final long  SIGN_BIT_MASK  = 0x8000000000000000L;
a perfectly legal statement and its Kotlin counterpart
Copy code
const val SIGN_BIT_MASK: Long = 0x8000000000000000L
results in an error? (Value out of range.) Such inconsistencies make it very difficult to port any Math libraries from Java to Kotlin.
t
You might want to try ULong in the Kotlin code which is unsigned. I think it is a bit of inconsisteny on the Java side that long may be unsigned or signed while other types are signed by default.
🙏 1
m
Thanks, I’ll give ULong a try.
It worked although it is a bit complicated by the fact that
Double.toRawBits
and
Double.fromBits
only use Long but not
ULong
. But with the conversion
.toLong
it works.