If you convert a double to UInt64, Real Studio will not work right for high numbers. If you have a double with value 18446744073709541376 and you assign it to an UInt64, you get 9223372036854775808. Seems like internally they use Int64 for this.
dim x as UInt64 = 18446744073709541376
dim d as Double = x
dim u as uint64 = d
MsgBox str(x)+" "+str(d)+" "+str(u)
and try this:
dim d as Double = 18446744073709541376
As you see things don't work as expected, so I filled two bug reports: #16715 and #16714