73: Avoid `as` casts in default FromPrimitive methods r=cuviper a=cuviper
Particularly, the default `from_f64` used `n as i64`, which has
undefined behavior on overflow, kind of defeating the purpose here.
Now we use a checked `to_i64()` for this, and even try `to_u64()` as a
fallback for completeness.
Also make similar changes to default `ToPrimitive`, but at least it
didn't have the same casting problem.
Co-authored-by: Josh Stone <cuviper@gmail.com>