| 1 |
# Date: Mon, 19 Dec 2005 18:14:13 -0800 |
| 2 |
# From: David Ellsworth <[email protected]> |
| 3 |
# Subject: Re: gawk number to string bug |
| 4 |
# To: [email protected], [email protected] |
| 5 |
# Cc: [email protected], [email protected], |
| 6 |
# [email protected], [email protected] |
| 7 |
# Message-id: <[email protected]> |
| 8 |
# |
| 9 |
# Since you are taking my bug report seriously (which is really great), |
| 10 |
# let me add some more fuel to the fire. Consider this program: |
| 11 |
# |
| 12 |
# BEGIN { x=2**60; for(i=60;i<=65;i++) { printf "2^%d= %s %d %g\n",i,x,x,x; x*=2}} |
| 13 |
# |
| 14 |
# which prints out powers of two around 2^63. On an Opteron (as well as |
| 15 |
# an Itanium), you get |
| 16 |
# |
| 17 |
# 2^60= 1152921504606846976 1152921504606846976 1.15292e+18 |
| 18 |
# 2^61= 2305843009213693952 2305843009213693952 2.30584e+18 |
| 19 |
# 2^62= 4611686018427387904 4611686018427387904 4.61169e+18 |
| 20 |
# 2^63= -9223372036854775808 9223372036854775808 9.22337e+18 |
| 21 |
# 2^64= 1.84467e+19 0 1.84467e+19 |
| 22 |
# 2^65= 3.68935e+19 3.68935e+19 3.68935e+19 |
| 23 |
# |
| 24 |
# On a Xeon, you get |
| 25 |
# |
| 26 |
# 2^60= 1.15292e+18 1152921504606846976 1.15292e+18 |
| 27 |
# 2^61= 2.30584e+18 2305843009213693952 2.30584e+18 |
| 28 |
# 2^62= 4.61169e+18 4611686018427387904 4.61169e+18 |
| 29 |
# 2^63= 9.22337e+18 9223372036854775808 9.22337e+18 |
| 30 |
# 2^64= 1.84467e+19 0 1.84467e+19 |
| 31 |
# 2^65= 3.68935e+19 3.68935e+19 3.68935e+19 |
| 32 |
# |
| 33 |
# The 2^64 value for %d is probably also a bug since the outputs |
| 34 |
# for 2^63 and 2^65 are reasonable. |
| 35 |
# |
| 36 |
# - David |
| 37 |
# |
| 38 |
|
| 39 |
BEGIN { |
| 40 |
x = 2 ^ 60 |
| 41 |
# for (i = 60; i <= 65; i++) { |
| 42 |
for (i = 60; i <= 63; i++) { |
| 43 |
printf "2^%d= %s %d %g %o\n", i, x, x, x, x |
| 44 |
x *= 2 |
| 45 |
} |
| 46 |
} |