On Mon, Jan 27, 2020 at 07:25:04PM +0100, Guillem Jover wrote: > Control: tags -1 - unreproducible moreinfo > > On Sun, 2020-01-26 at 20:25:46 +0100, Andreas Henriksson wrote: > > Control: tags -1 + unreproducible moreinfo > > > I did a quick attempt at reproducing this but failed to do so with > > the current version in unstable. > > > > $ find ~/Downloads/ -ls -type f | awk 'BEGIN{ ttl=0 }{ ttl+=$7 }END{ > > print ttl }' > > 18945235595 > > $ du -sh ~/Downloads/ > > 18G /home/ah/Downloads/ > > > > Possibly the bug has been fixed since the original bug report, but > > it seems unlikely as it's the same upstream version still. > > Probably a better testcase to easily be able to reproduce this issue > > is needed, so tagging accordingly... > > Are you sure you were testing mawk instead of say gawk? It reproduces > for me here: > > $ mawk -- 'BEGIN{ttl=2^48;printf("%i\n",ttl)}' </dev/null > 2147483647 > $ gawk -- 'BEGIN{ttl=2^48;printf("%i\n",ttl)}' </dev/null > 281474976710656
I don't see that here. mawk uses double's for floating point (no 64-digit arithmetic). That's perhaps not as clear as one might wish in the manpage: 2. Data types, conversion and comparison There are two basic data types, numeric and string. Numeric constants can be integer like -2, decimal like 1.08, or in scientific notation like -1.1e4 or .28E-3. All numbers are represented internally and all computations are done in floating point arithmetic. So for example, the expression 0.2e2 == 20 is true and true is represented as 1.0. But gawk's manual (more than twice as long) gives no insight; original-awk's man (less than twice as long) likewise is uninformative. Back to the point: mawk's not using plain integers in the given example. I ran that example (with a larger directory) using mawk, gawk, original-awk (on Debian 64-bits): ** mawk 2.61152e+11 ** gawk 261151514660 ** original-awk 261151514660 and the equivalent on my FreeBSD 11 32-bit machine ("awk" is original-awk): ** awk 261151514660 ** mawk 2.61152e+11 ** gawk 261151514660 (I dropped Debian 32-bits because it was too unstable). Those gave me the same results, as you can see. Whether mawk should print large numbers in floating point doesn't appear to be the issue here. -- Thomas E. Dickey <dic...@invisible-island.net> https://invisible-island.net ftp://ftp.invisible-island.net
signature.asc
Description: PGP signature