refs #9022 moved error calculating function into anonymous namespace.

nof if I am familiar with this style or finding it clearer then usual file scope function.