use float/double type to do calculation when need to resize
Merge pull request #252 from zizon/master

Fix size calculation