make these inline templates and always cast to double