Fix conversion of inf and nan from double to float