holgerbrandl
11/29/2020, 6:40 PMNumber.toDouble() "involve rounding" as suggested by its API docs?ephemient
11/29/2020, 6:45 PMephemient
11/29/2020, 6:46 PM>>> (2L shl 53) + 1
res0: kotlin.Long = 18014398509481985
>>> ((2L shl 53) + 1).toDouble().toLong()
res1: kotlin.Long = 18014398509481984ephemient
11/29/2020, 6:54 PMlouiscad
11/29/2020, 6:57 PMephemient
11/29/2020, 7:04 PMephemient
11/29/2020, 7:05 PMholgerbrandl
11/29/2020, 7:20 PMNumber value does not fit into the target type range, so some more details in the Number API docs would be great.holgerbrandl
11/29/2020, 7:26 PMNumber docs state that it may involve rounding or truncation. which covers range issues. So the docs are somehow correct, although the big odd integers to double example is neither rounding nor truncation, so there is imho some inprecision in the docs.ephemient
11/29/2020, 7:36 PMephemient
11/29/2020, 7:39 PM2.toBigInteger().pow(1024).toDouble() == Double.POSITIVE_INFINITYholgerbrandl
11/29/2020, 7:42 PM