3 ms·
Using the midpoint function is the most readable. https://en.cppreference.com/w/cpp/numeric/midpoint https://en.cppreference.com/w/cpp/numeric/midpoint Though
by tiffanyh 4y ago
Using the midpoint function is the most readable.
https://en.cppreference.com/w/cpp/numeric/midpoint https://en.cppreference.com/w/cpp/numeric/midpoint
Though it's odd this allows overflow.
- abainbridge 4y agostd::midpoint also seems to yield less efficient code with g++12 targeting x86-64: https://godbolt.org/z/j695ce98Y https://godbolt.org/z/j695ce98Y
- Lockal 4y agostd::midpoint does different thing in terms of rounding, therefore comparison is not fair.