refactor 27
refactor 28
bug fix in cast to double
Fixed bug introduced by premature optimization

This was possibility was taken into account, the code fix was in
comments.
Minimized precision lost by providing extra bits

The mantissa passed to BuildDouble and BuildSingle now have one extra
bit (53 bits for double and 24 bits for float). Also the number of
required bits for double was wrong, this has been fixed in this commit.