Minor bugfix in waveform-compare. Change to proper type for integral sum. Fixed missing division by 2 bug.