add math square
This commit is contained in:
@@ -41,4 +41,10 @@ namespace hack::math
|
||||
// см. wiki/math
|
||||
return n * (2 * a1 + (n - 1) * d) / 2;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T square(T x) { return x * x; }
|
||||
|
||||
template<typename T>
|
||||
constexpr T cube(T x) { return x * x * x; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user