I have a function that takes floats, I'm doing some computation with them, and I'd like to keep as much accuracy as possible in the returned result. I read that when you multiply two floats, you double the number of significant digits.

So when two floats get multiplied, for example `float e, f;` and I do `double g = e * f`, when do the bits get truncated?

In my example function below, do I need casting, and if yes, where? This is in a tight inner loop, if I put `static_cast<double>(x)` around each variable `a b c d` where it's used, I get 5-10% slowdown. But I suspect I don't need to cast each variable separately, and only in some locations, if at all? Or does returning a double here do not give me any gain anyway and I can as well just return a float?

```
double func(float a, float b, float c, float d) {
    return (a - b) * c + (a - c) * b;
}

```