function f = factorialInt32(n)
% factorialInt32(n) returns the factorial of n with all calculations of type int32.
   f=int32(1);
   while(n>1)
       f=f*int32(n);
       n=int32(n-1);
   end