http://www.perlmonks.org?node_id=824924


in reply to May I be bitten by floating point arithmetic in the following restricted case?

Take a look at POSIX::frexp(). It seems to do the right thing all the way to the 53-bit limit of doubles. It gets a little flakey thereafter:

printf "-1:%2d %30f:%d +1:%2d\n", (frexp( $_ - 1 ))[1], $_, (frexp( $_ ))[1], (frexp( $_ +1 ))[1] for map 2**$_, 1 .. 64;; -1: 1 2.000000:2 +1: 2 -1: 2 4.000000:3 +1: 3 -1: 3 8.000000:4 +1: 4 -1: 4 16.000000:5 +1: 5 -1: 5 32.000000:6 +1: 6 -1: 6 64.000000:7 +1: 7 -1: 7 128.000000:8 +1: 8 -1: 8 256.000000:9 +1: 9 -1: 9 512.000000:10 +1:10 -1:10 1024.000000:11 +1:11 -1:11 2048.000000:12 +1:12 -1:12 4096.000000:13 +1:13 -1:13 8192.000000:14 +1:14 -1:14 16384.000000:15 +1:15 -1:15 32768.000000:16 +1:16 -1:16 65536.000000:17 +1:17 -1:17 131072.000000:18 +1:18 -1:18 262144.000000:19 +1:19 -1:19 524288.000000:20 +1:20 -1:20 1048576.000000:21 +1:21 -1:21 2097152.000000:22 +1:22 -1:22 4194304.000000:23 +1:23 -1:23 8388608.000000:24 +1:24 -1:24 16777216.000000:25 +1:25 -1:25 33554432.000000:26 +1:26 -1:26 67108864.000000:27 +1:27 -1:27 134217728.000000:28 +1:28 -1:28 268435456.000000:29 +1:29 -1:29 536870912.000000:30 +1:30 -1:30 1073741824.000000:31 +1:31 -1:31 2147483648.000000:32 +1:32 -1:32 4294967296.000000:33 +1:33 -1:33 8589934592.000000:34 +1:34 -1:34 17179869184.000000:35 +1:35 -1:35 34359738368.000000:36 +1:36 -1:36 68719476736.000000:37 +1:37 -1:37 137438953472.000000:38 +1:38 -1:38 274877906944.000000:39 +1:39 -1:39 549755813888.000000:40 +1:40 -1:40 1099511627776.000000:41 +1:41 -1:41 2199023255552.000000:42 +1:42 -1:42 4398046511104.000000:43 +1:43 -1:43 8796093022208.000000:44 +1:44 -1:44 17592186044416.000000:45 +1:45 -1:45 35184372088832.000000:46 +1:46 -1:46 70368744177664.000000:47 +1:47 -1:47 140737488355328.000000:48 +1:48 -1:48 281474976710656.000000:49 +1:49 -1:49 562949953421312.000000:50 +1:50 -1:50 1125899906842624.000000:51 +1:51 -1:51 2251799813685248.000000:52 +1:52 -1:52 4503599627370496.000000:53 +1:53 -1:53 9007199254740992.000000:54 +1:54 -1:55 18014398509481984.000000:55 +1:55 -1:56 36028797018963968.000000:56 +1:56 -1:57 72057594037927936.000000:57 +1:57 -1:58 144115188075855870.000000:58 +1:58 -1:59 288230376151711740.000000:59 +1:59 -1:60 576460752303423490.000000:60 +1:60 -1:61 1152921504606847000.000000:61 +1:61 -1:62 2305843009213694000.000000:62 +1:62 -1:63 4611686018427387900.000000:63 +1:63 -1:64 9223372036854775800.000000:64 +1:64 -1:65 18446744073709552000.000000:65 +1:65

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.