replaced bitshift with ldexp()