mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
Initial commit
This commit is contained in:
56
blacklib/include/blackcore/math.h
Normal file
56
blacklib/include/blackcore/math.h
Normal file
@@ -0,0 +1,56 @@
|
||||
//! Copyright (C) 2013 Roland Winklmeier
|
||||
//! This Source Code Form is subject to the terms of the Mozilla Public
|
||||
//! License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
//! file, You can obtain one at http://mozilla.org/MPL/2.0/
|
||||
|
||||
#ifndef MATH_H
|
||||
#define MATH_H
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
|
||||
class CMath
|
||||
{
|
||||
public:
|
||||
//! Calculates the hypotenuse of x and y without overflow
|
||||
/*!
|
||||
\param x
|
||||
\param y
|
||||
*/
|
||||
static double hypot(double x, double y);
|
||||
|
||||
//! Calculates the square of x
|
||||
/*!
|
||||
\param x
|
||||
\return x^2
|
||||
*/
|
||||
static inline double square(const double x)
|
||||
{
|
||||
return x*x;
|
||||
}
|
||||
|
||||
//! Calculates x to the power of three
|
||||
/*!
|
||||
\param x
|
||||
\return x^3
|
||||
*/
|
||||
static inline double cubic(const double x)
|
||||
{
|
||||
return x*x*x;
|
||||
}
|
||||
|
||||
//! Calculates the real cubic root
|
||||
/*!
|
||||
\param x
|
||||
\param y
|
||||
\return Returns the real part of the solution
|
||||
*/
|
||||
static double cubicRootReal(const double x);
|
||||
|
||||
private:
|
||||
CMath() {}
|
||||
};
|
||||
|
||||
} // namespace BlackCore
|
||||
|
||||
#endif // MATH_H
|
||||
Reference in New Issue
Block a user