Fixes an off by 1 issue related to double->float->double conversion, and eliminates numerous warnings.