MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / my_hypot

Function my_hypot

Examples/NoModules/Chapter 11/Ex11_08/Ex11_08.cpp:6–13  ·  view source on GitHub ↗

Make names from the math namespace available locally */

Source from the content-addressed store, hash-verified

4
5/* Make names from the math namespace available locally */
6auto my_hypot(const auto& x, const auto& y) // Renamed to my_hypot to avoid clashes with hypot() function in <cmath>
7{
8 using namespace math;
9 // Or:
10 // using math::square;
11 // using math::sqrt; /* Same as, of course: using std::sqrt; */
12 return sqrt(square(x) + square(y));
13}
14
15int main()
16{

Callers 1

mainFunction · 0.85

Calls 1

squareFunction · 0.70

Tested by

no test coverage detected