Fixes #5031 Template the delay value and cast to float for loops