Fix #136 by clamping the y component of the normalized vector between -1.0 and 1.0 for acos.
The reason why this is needed is normalize sometimes results in a vector of length > 1 due to the nature of floating point arithmetic, but also not help that the normalize implementation casts sqrt to a float then back to a double.
Which when along the y axis breaks acos because it expects a number [-1.0,1.0].
Fix #136 by clamping the y component of the normalized vector between -1.0 and 1.0 for
acos
. The reason why this is needed is normalize sometimes results in a vector of length > 1 due to the nature of floating point arithmetic, but also not help that the normalize implementation casts sqrt to a float then back to a double. Which when along the y axis breaks acos because it expects a number[-1.0,1.0]
.