gcc/libstdc++-v3/include/c_global
Jonathan Wakely 243874426d Define midpoint and lerp functions for C++20 (P0811R3)
The implementation of midpoint used for integral types is due to Howard
Hinnant and avoids a branch for int and larger types (but not for chars
and shorts).

The midpoint and lerp functions for floating point types come straight
from the P0811R3 proposal, with no attempt at optimization.

	* include/c_compatibility/math.h [C++20] (lerp): Add using
	declaration.
	* include/c_global/cmath [C++20] (__cpp_lib_interpolate): Define.
	(__lerp): Define function template to implement lerp.
	(lerp(float, float, float), lerp(double, double, double))
	(lerp(long double, long double, long double)): Define for C++20.
	* include/std/numeric [C++20] (__cpp_lib_interpolate): Define.
	(midpoint(T, T), midpoint(T*, T*)): Define.
	* include/std::version [C++20] (__cpp_lib_interpolate): Define.
	* testsuite/26_numerics/lerp.cc: New test.
	* testsuite/26_numerics/midpoint/floating.cc: New test.
	* testsuite/26_numerics/midpoint/integral.cc: New test.
	* testsuite/26_numerics/midpoint/pointer.cc: New test.

From-SVN: r269398
2019-03-05 18:37:24 +00:00
..
cassert Update copyright years. 2019-01-01 13:31:55 +01:00
ccomplex Update copyright years. 2019-01-01 13:31:55 +01:00
cctype Update copyright years. 2019-01-01 13:31:55 +01:00
cerrno Update copyright years. 2019-01-01 13:31:55 +01:00
cfenv Update copyright years. 2019-01-01 13:31:55 +01:00
cfloat Update copyright years. 2019-01-01 13:31:55 +01:00
cinttypes Update copyright years. 2019-01-01 13:31:55 +01:00
ciso646 Update copyright years. 2019-01-01 13:31:55 +01:00
climits Update copyright years. 2019-01-01 13:31:55 +01:00
clocale Update copyright years. 2019-01-01 13:31:55 +01:00
cmath Define midpoint and lerp functions for C++20 (P0811R3) 2019-03-05 18:37:24 +00:00
csetjmp Update copyright years. 2019-01-01 13:31:55 +01:00
csignal Update copyright years. 2019-01-01 13:31:55 +01:00
cstdalign Update copyright years. 2019-01-01 13:31:55 +01:00
cstdarg Update copyright years. 2019-01-01 13:31:55 +01:00
cstdbool Update copyright years. 2019-01-01 13:31:55 +01:00
cstddef P0482R5 char8_t: Standard library support 2019-02-19 02:54:42 +00:00
cstdint Update copyright years. 2019-01-01 13:31:55 +01:00
cstdio Update copyright years. 2019-01-01 13:31:55 +01:00
cstdlib Update copyright years. 2019-01-01 13:31:55 +01:00
cstring Update copyright years. 2019-01-01 13:31:55 +01:00
ctgmath Update copyright years. 2019-01-01 13:31:55 +01:00
ctime Add std::timespec and std::timespec_get for C++17 2019-02-14 14:10:25 +00:00
cuchar Update copyright years. 2019-01-01 13:31:55 +01:00
cwchar Update copyright years. 2019-01-01 13:31:55 +01:00
cwctype Update copyright years. 2019-01-01 13:31:55 +01:00