From: Ian Scott <ian.scott@st...>  20020208 17:41:55

Hi, I've noticed a problem with T cos_angle(vnl_vector a, vnl_vector b) occasionally (when a&b point in the same direction) rounding errors cause cos_angle to return (1+eps). vcl_acos(1+eps) returns NaN. So this makes double angle(vnl_vector a, vnl_vector b) fail. Now I could fix the problem by simply limiting the value returned by cos_angle to [+1,1], Unfortunately this is hard to do with the complex type templating in these functions.. Alternatives 1. rewrite cos_angle so that it is immune to this problem, However, we can't see how  any suggestions welcome. 2. Test the vnl_math_abs of the output of cos_angle, and if it is greater than 1, then divide the output by its magnitude. (Note this might not always work, since playing around with values close to 1 seems to be what caused the problem in the first place) 3. Get a better math unit for my processor :) 4. Any other suggestions? Ian. 