added ability to compute in both single and double precision