improved Num.of_float

same as the pull-request for the master branch.