This bit of code is unusual: vector = ... vector2 = vector.normalize! By convention, Ruby methods that end with a "!" work directly on the calling object's data. So vector.normalize! normalizes vector. You now have the normalized data in vector and a second reference to it in vector2. Not sure that was what you intended. I added a comment to the Vector3d class doc to clarify this. (If you learned from the doc you were misled.)