On Tuesday, 2 November 2021 at 16:29:07 UTC, rikki cattermole wrote:
You probably don't want to be using C variadics.

Instead try the typed one:

float mean(float[] input...) {
        // you don't want to divide by zero
        if (input.length == 0)
                return 0;

        float temp = 0;
        // floats and double initialize to NaN by default, not zero.
        
        foreach(value; input) {
                temp += value;
        }

        return temp / input.length;
}

"input..." seems nice, where can I get more information about it?

Reply via email to