Abstract the magnitude computation