I think we have a common math header for such conversions which really should be used instead.