Add a template function that allows conversion to float. This is useful, for example, when passing aspect ratios into templates, which tend to not be integers. Fixes #3307
Also add tests for ToInt and ToString. Resolves #3308