Add stable versions of normalize() and normalized()
@chhtz
Submitted by Christoph HertzbergAssigned to dea..@..il.com
Link to original bugzilla bug (#977)
Version: 3.3 (current stable)
Description
Our current implementation of normalize() and normalized() fails if squaredNorm() of the vector overflows or underflows.
We could add stable variants of these methods, which use stableNorm() instead of norm().
Special handling for a zero-vector and for the case that the vector contains infinities (or NaNs) could also be implemented. I'd suggest returning UnitX() in the first case. The latter case is debatable. Also see the discussion here:
https://bitbucket.org/eigen/eigen/pull-request/99