Thanks for catching that bug.  While fixing it I noticed some related 
minor glitches with ldexp, so I installed the attached patch.