Created
January 29, 2013 12:06
-
-
Save larsw/4663774 to your computer and use it in GitHub Desktop.
awk arit. sum vs. string concat wtf?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for i in `seq 1 10`; do mono vectorizedquerytest.exe ; done | awk 'BEGIN { FS="."; OFMT="%d"; sum = 0; sumsq = 0; } ; {print $2;sum = sum + $2; sumsq = sumsq + $2*$2; } END { print "average:"; print sum / NR; print "std dev:"; print sqrt(sumsq/NR - (sum/NR)**2); }' | |
| # the average/std dev output are fucked up in 19/20 times; it seems like awk sometimes does string concat, other times sum. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment