This package computes Euclidean Norm (distance) accurately without overflow.
enorm.h - Header file.
enorm.c - Code file.
No warranty, express or implied, should be assumed for these code fragments. They are for educational and demonstration purposes, and may contain major errors.
This is a C implementation of Cleve Moler's Euclidean Norm algorithm. This algorithm is documented in the IBM Journal of Research and Development, Vol27, No 6, November 1983.
In effect, it computes sqrt(x*x+y*y), but it doesn't compute x*x or y*y so it will not overflow unless the answer overflows. The algorithm is generally much faster than the sqrt routine on a given machine.
This page is http://www.cc.utah.edu/~nahaj/cave/survey/code/c/enorm.html
© Copyright 2000 by John Halleck, All Rights Reserved.
This snapshot was last modified on August 23rd, 2000