Compacted error function