# Passive Transformation does not return the expectedt result due to precision of expressions

So I wish to perform a passive rotation in N dimensional space. Let me take N=5 for this question.

testvector=RandomVariate[NormalDistribution[],5];
testunitvector = UnitVector[5, 1];
basisrotation = Transpose[RotationMatrix[{testunitvec, testvector}]];
output=basisrotation.testvector;


I get something like

Out[] = {11.57583690, 0.*10^-9, 0.*10^-9, 0.*10^-9, 0.*10^-9}


while I expect to get something like this

Out[] = {11.57583690, 0., 0., 0., 0.}


no matter which precision I use. Is there any way to correct this? Thanks in advance!

RandomVariate takes the option WorkingPrecision. Any residual artifact can be removed with Chop.

testvector = RandomVariate[NormalDistribution[], 5, WorkingPrecision -> 20];

testunitvector = UnitVector[5, 1];

basisrotation = Transpose[RotationMatrix[{testunitvector, testvector}]];


Note that I corrected typo in definition of basisrotation

output = basisrotation.testvector // Chop

(*  {3.163849275428872542, 0, 0, 0, 0}  *)