modifying ldexp in order for it to be consistent with frexp