The standards committee adopted "P0811: Well-behaved interpolation for numbers and pointers" for C++20. It includes a new library call `std::midpoint`. The paper says "The simple problem of computing a value between two other values is surprisingly subtle in general."
In this talk, I will explore this simple call, provide a history of the development in libc++, and show some of the pitfalls. Undefined behavior will rear its ugly head, along with numeric representations, and the arcane C promotion rules.
Along the way, we'll talk about testing, and why writing extensive tests helps everyone.