Yes, but here's a fix.
If somebody with a 64-bit machine would run this, and post the output I
would appreciate it.
# include <stdio.h>
# include <stddef.h>
int main(void) {
ptrdiff_t last, next;
for (last = 32767; (next = 2 * (double)last + 1) > last; ) {
printf ("last = %ld double = %f next = %ld\n", (long)last, 2 *
(double)last, (long)next);
last = next;
}
printf("%ld\n", (long) last);
return 0;
}
last = 32767 double = 65534.000000 next = 65535
last = 65535 double = 131070.000000 next = 131071
last = 131071 double = 262142.000000 next = 262143
last = 262143 double = 524286.000000 next = 524287
last = 524287 double = 1048574.000000 next = 1048575
last = 1048575 double = 2097150.000000 next = 2097151
last = 2097151 double = 4194302.000000 next = 4194303
last = 4194303 double = 8388606.000000 next = 8388607
last = 8388607 double = 16777214.000000 next = 16777215
last = 16777215 double = 33554430.000000 next = 33554431
last = 33554431 double = 67108862.000000 next = 67108863
last = 67108863 double = 134217726.000000 next = 134217727
last = 134217727 double = 268435454.000000 next = 268435455
last = 268435455 double = 536870910.000000 next = 536870911
last = 536870911 double = 1073741822.000000 next = 1073741823
last = 1073741823 double = 2147483646.000000 next = 2147483647
last = 2147483647 double = 4294967294.000000 next = -1
last = -1 double = 8589934590.000000 next = -1
last = -1 double = 17179869182.000000 next = -1
last = -1 double = 34359738366.000000 next = -1
last = -1 double = 68719476734.000000 next = -1
last = -1 double = 137438953470.000000 next = -1
last = -1 double = 274877906942.000000 next = -1
last = -1 double = 549755813886.000000 next = -1
last = -1 double = 1099511627774.000000 next = -1
last = -1 double = 2199023255550.000000 next = -1
last = -1 double = 4398046511102.000000 next = -1
last = -1 double = 8796093022206.000000 next = -1
last = -1 double = 17592186044414.000000 next = -1
last = -1 double = 35184372088830.000000 next = -1
last = -1 double = 70368744177662.000000 next = -1
last = -1 double = 140737488355326.000000 next = -1
last = -1 double = 281474976710654.000000 next = -1
last = -1 double = 562949953421310.000000 next = -1
last = -1 double = 1125899906842622.000000 next = -1
last = -1 double = 2251799813685246.000000 next = -1
last = -1 double = 4503599627370494.000000 next = -1
last = -1 double = 9007199254740990.000000 next = -1
last = -1 double = 18014398509481982.000000 next = 0
last = 0 double = 36028797018963968.000000 next = 0
last = 0 double = 72057594037927936.000000 next = 0
last = 0 double = 144115188075855870.000000 next = 0
last = 0 double = 288230376151711740.000000 next = 0
last = 0 double = 576460752303423490.000000 next = 0
last = 0 double = 1152921504606847000.000000 next = 0
last = 0 double = 2305843009213694000.000000 next = 0
last = 0 double = 4611686018427387900.000000 next = 0
0