improved Num.of_float

hi, this also handles nan, infinity and 0.
testcases have also been added.