Ceylan::Maths Namespace Reference

Contains all maths-related operations and constants. More...

Namespaces

namespace  Linear
 

Gathers all linear-based computations, main geometric.


namespace  Random
 

Gathers all stochastic mechanisms.


Classes

class  MathsException
 Exception for Maths-related issues. More...
class  IntToIntFunctor
 A functor dealing with integers (one integer as parameter, returns integer). More...

Typedefs

typedef Ceylan::Sint32 IntegerData
 Generic signed integer data.
typedef Ceylan::Float32 Real
 Real is the floating-point coordinate used in Ceylan's linear services.
typedef Ceylan::Float32 AngleInDegrees
 Angles, expressed in degrees.
typedef Ceylan::Float32 AngleInRadians
 Angles, expressed in radians.
typedef Ceylan::Uint8 Percentage
 Integer percentage values, which should range from 0 to 100, both included.
typedef Ceylan::Uint32 Hertz
 Unit for frequencies (Hz).
typedef Ceylan::Float32 Ratio
 Ratio unit, should store floating point values between 0 and 1.

Functions

CEYLAN_DLL bool IsNull (Ceylan::Float32 x)
 Tells whether x is null as regard to floating point numbers: | x | < EpsilonFloat32.
CEYLAN_DLL bool IsNull (Ceylan::Float32 x, Ceylan::Float32 epsilon)
 Tells whether x is null as regard to floating point numbers: | x | < epsilon.
CEYLAN_DLL bool IsNull (Ceylan::Float64 x)
 Tells whether x is null as regard to floating point numbers: | x | < EpsilonFloat64.
CEYLAN_DLL bool IsNull (Ceylan::Float64 x, Ceylan::Float64 epsilon)
 Tells whether x is null as regard to floating point numbers: | x | < epsilon.
CEYLAN_DLL bool IsNull (Ceylan::LongFloat x)
 Tells whether x is null as regard to floating point numbers: | x | < EpsilonLongFloat.
CEYLAN_DLL bool IsNull (Ceylan::LongFloat x, Ceylan::LongFloat epsilon)
 Tells whether x is null as regard to floating point numbers: | x | < epsilon.
CEYLAN_DLL bool AreEqual (Ceylan::Float32 x, Ceylan::Float32 y)
 Tells whether x and y are 'equal' as floating point numbers: | x - y | < EpsilonFloat32.
CEYLAN_DLL bool AreEqual (Ceylan::Float32 x, Ceylan::Float32 y, Ceylan::Float32 epsilon)
 Tells whether x and y are 'equal' as floating point numbers: | x - y | < epsilon.
CEYLAN_DLL bool AreEqual (Ceylan::Float64 x, Ceylan::Float64 y)
 Tells whether x and y are 'equal' as floating point numbers: | x - y | < EpsilonFloat64.
CEYLAN_DLL bool AreEqual (Ceylan::Float64 x, Ceylan::Float64 y, Ceylan::Float64 epsilon)
 Tells whether x and y are 'equal' as floating point numbers: | x - y | < epsilon.
CEYLAN_DLL bool AreExactlyEqual (Ceylan::Float64 x, Ceylan::Float64 y)
 Tells whether x and y are exactly 'equal': x == y, with no compile warning about the fact that comparing floating point values with == operator is most of the time absurd, which is true indeed.
CEYLAN_DLL bool AreEqual (Ceylan::LongFloat x, Ceylan::LongFloat y)
 Tells whether x and y are 'equal' as floating point numbers: | x - y | < EpsilonLongFloat.
CEYLAN_DLL bool AreEqual (Ceylan::LongFloat x, Ceylan::LongFloat y, Ceylan::LongFloat epsilon)
 Tells whether x and y are 'equal' as floating point numbers: | x - y | < epsilon.
template<typename T >
bool AreRelativelyEqual (T x, T y)
 Relative comparison.
template<typename T >
bool AreRelativelyEqual (T x, T y, Ceylan::LongFloat epsilon)
 Relative comparison with user-supplied epsilon.
CEYLAN_DLL Ceylan::Float32 Floor (Ceylan::Float32 x)
CEYLAN_DLL Ceylan::Float64 Floor (Ceylan::Float64 x)
CEYLAN_DLL Ceylan::LongFloat Floor (Ceylan::LongFloat x)
CEYLAN_DLL Ceylan::Float32 Ceil (Ceylan::Float32 x)
CEYLAN_DLL Ceylan::Float64 Ceil (Ceylan::Float64 x)
CEYLAN_DLL Ceylan::LongFloat Ceil (Ceylan::LongFloat x)
CEYLAN_DLL Ceylan::Float32 Round (Ceylan::Float32 x)
CEYLAN_DLL Ceylan::Float32 Round (Ceylan::Float32 x, Ceylan::Uint8 precision)
CEYLAN_DLL Ceylan::Float64 Round (Ceylan::Float64 x)
CEYLAN_DLL Ceylan::Float64 Round (Ceylan::Float64 x, Ceylan::Uint8 precision)
CEYLAN_DLL Ceylan::LongFloat Round (Ceylan::LongFloat x)
CEYLAN_DLL Ceylan::LongFloat Round (Ceylan::LongFloat x, Ceylan::Uint8 precision)
CEYLAN_DLL Ceylan::Sint8 Abs (Ceylan::Sint8 x)
 Absolute value, polluted by ambiguous calls:
CEYLAN_DLL Ceylan::Sint16 Abs (Ceylan::Sint16 x)
 Computes the absolute value of specified argument.
CEYLAN_DLL Ceylan::Sint32 Abs (Ceylan::Sint32 x)
 Computes the absolute value of specified argument.
CEYLAN_DLL
Ceylan::SignedLongInteger 
Abs (Ceylan::SignedLongInteger x)
 Computes the absolute value of specified argument.
CEYLAN_DLL Ceylan::Float32 Abs (Ceylan::Float32 x)
 Computes the absolute value of specified argument.
CEYLAN_DLL Ceylan::Float64 Abs (Ceylan::Float64 x)
 Computes the absolute value of specified argument.
CEYLAN_DLL Ceylan::LongFloat Abs (Ceylan::LongFloat x)
 Computes the absolute value of specified argument.
template<typename T >
Min (T x, T y)
 Min:
template<typename T >
Min (T x, T y, T z)
 Three-argument Min operator.
CEYLAN_DLL Ceylan::Sint8 Min (Ceylan::Sint8 x, Ceylan::Sint8 y)
 Returns the minimum value of specified parameters.
CEYLAN_DLL Ceylan::Uint8 Min (Ceylan::Uint8 x, Ceylan::Uint8 y)
 Returns the minimum value of specified parameters.
CEYLAN_DLL Ceylan::Sint16 Min (Ceylan::Sint16 x, Ceylan::Sint16 y)
 Returns the minimum value of specified parameters.
CEYLAN_DLL Ceylan::Uint16 Min (Ceylan::Uint16 x, Ceylan::Uint16 y)
 Returns the minimum value of specified parameters.
CEYLAN_DLL Ceylan::Sint32 Min (Ceylan::Sint32 x, Ceylan::Sint32 y)
 Returns the minimum value of specified parameters.
CEYLAN_DLL Ceylan::Uint32 Min (Ceylan::Uint32 x, Ceylan::Uint32 y)
 Returns the minimum value of specified parameters.
CEYLAN_DLL
Ceylan::SignedLongInteger 
Min (Ceylan::SignedLongInteger x, Ceylan::SignedLongInteger y)
 Returns the minimum value of specified parameters.
CEYLAN_DLL
Ceylan::UnsignedLongInteger 
Min (Ceylan::UnsignedLongInteger x, Ceylan::UnsignedLongInteger y)
 Returns the minimum value of specified parameters.
CEYLAN_DLL Ceylan::Float32 Min (Ceylan::Float32 x, Ceylan::Float32 y)
 Returns the minimum value of specified parameters.
CEYLAN_DLL Ceylan::Float64 Min (Ceylan::Float64 x, Ceylan::Float64 y)
 Returns the minimum value of specified parameters.
CEYLAN_DLL Ceylan::LongFloat Min (Ceylan::LongFloat x, Ceylan::LongFloat y)
 Returns the minimum value of specified parameters.
template<typename T >
Max (T x, T y)
 Max:
CEYLAN_DLL Ceylan::Sint8 Max (Ceylan::Sint8 x, Ceylan::Sint8 y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL Ceylan::Uint8 Max (Ceylan::Uint8 x, Ceylan::Uint8 y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL Ceylan::Sint16 Max (Ceylan::Sint16 x, Ceylan::Sint16 y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL Ceylan::Uint16 Max (Ceylan::Uint16 x, Ceylan::Uint16 y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL Ceylan::Sint32 Max (Ceylan::Sint32 x, Ceylan::Sint32 y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL Ceylan::Uint32 Max (Ceylan::Uint32 x, Ceylan::Uint32 y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL
Ceylan::SignedLongInteger 
Max (Ceylan::SignedLongInteger x, Ceylan::SignedLongInteger y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL
Ceylan::UnsignedLongInteger 
Max (Ceylan::UnsignedLongInteger x, Ceylan::UnsignedLongInteger y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL Ceylan::Float32 Max (Ceylan::Float32 x, Ceylan::Float32 y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL Ceylan::Float64 Max (Ceylan::Float64 x, Ceylan::Float64 y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL Ceylan::LongFloat Max (Ceylan::LongFloat x, Ceylan::LongFloat y)
 Returns the maximum value of specified parameters.
CEYLAN_DLL Ceylan::Float32 Exp (Ceylan::Float32 x)
 Computes the value of e (the base of natural logarithms) raised to the power of x.
CEYLAN_DLL Ceylan::Float64 Exp (Ceylan::Float64 x)
 Computes the value of e (the base of natural logarithms) raised to the power of x.
CEYLAN_DLL Ceylan::LongFloat Exp (Ceylan::LongFloat x)
 Computes the value of e (the base of natural logarithms) raised to the power of x.
CEYLAN_DLL Ceylan::Float32 Pow (Ceylan::Float32 x, Ceylan::Float32 y)
 Computes the value of x raised to the power of y.
CEYLAN_DLL Ceylan::Float64 Pow (Ceylan::Float64 x, Ceylan::Float64 y)
 Computes the value of x raised to the power of y.
CEYLAN_DLL Ceylan::LongFloat Pow (Ceylan::LongFloat x, Ceylan::LongFloat y)
 Computes the value of x raised to the power of y.
CEYLAN_DLL Ceylan::Float32 Pow2 (Ceylan::Float32 x)
 Computes the value of x² (x*x).
CEYLAN_DLL Ceylan::Float64 Pow2 (Ceylan::Float64 x)
 Computes the value of x² (x*x).
CEYLAN_DLL Ceylan::LongFloat Pow2 (Ceylan::LongFloat x)
 Computes the value of x² (x*x).
CEYLAN_DLL Ceylan::Float32 Log (Ceylan::Float32 x)
 Computes the value of the natural logarithm of argument x.
CEYLAN_DLL Ceylan::Float64 Log (Ceylan::Float64 x)
 Computes the value of the natural logarithm of argument x.
CEYLAN_DLL Ceylan::LongFloat Log (Ceylan::LongFloat x)
 Computes the value of the natural logarithm of argument x.
CEYLAN_DLL Ceylan::Float32 Sqrt (Ceylan::Float32 x)
 Computes the non-negative square root of x.
CEYLAN_DLL Ceylan::Float64 Sqrt (Ceylan::Float64 x)
 Computes the non-negative square root of x.
CEYLAN_DLL Ceylan::LongFloat Sqrt (Ceylan::LongFloat x)
 Computes the non-negative square root of x.
CEYLAN_DLL Ceylan::Float32 Cos (Ceylan::Float32 angle)
 Computes the cosine of 'angle', where angle is given in radians.
CEYLAN_DLL Ceylan::Float64 Cos (Ceylan::Float64 angle)
 Computes the cosine of 'angle', where angle is given in radians.
CEYLAN_DLL Ceylan::LongFloat Cos (Ceylan::LongFloat angle)
 Computes the cosine of 'angle', where angle is given in radians.
CEYLAN_DLL Ceylan::Float32 Sin (Ceylan::Float32 angle)
 Computes the sine of 'angle', where angle is given in radians.
CEYLAN_DLL Ceylan::Float64 Sin (Ceylan::Float64 angle)
 Computes the sine of 'angle', where angle is given in radians.
CEYLAN_DLL Ceylan::LongFloat Sin (Ceylan::LongFloat angle)
 Computes the sine of 'angle', where angle is given in radians.
CEYLAN_DLL Ceylan::Float32 Tan (Ceylan::Float32 angle)
 Computes the tangent of 'angle', where angle is given in radians.
CEYLAN_DLL Ceylan::Float64 Tan (Ceylan::Float64 angle)
 Computes the tangent of 'angle', where angle is given in radians.
CEYLAN_DLL Ceylan::LongFloat Tan (Ceylan::LongFloat angle)
 Computes the tangent of 'angle', where angle is given in radians.
CEYLAN_DLL AngleInRadians DegreeToRadian (AngleInDegrees angleInDegrees)
 Converts an angle expressed in degrees into an angle expressed in radians.
CEYLAN_DLL Uint16 NextPowerOfTwo (Uint16 value)
 Returns the first power of 2 greater or equal to the specified value.
CEYLAN_DLL bool IsAPowerOfTwo (Uint16 value)
 Tells whether the specified value is a power of two.
CEYLAN_DLL Uint16 NextMultipleOf (Uint16 multiple, Uint16 value)

Variables

CEYLAN_DLL const Ceylan::LongFloat E
 The number e.
CEYLAN_DLL const Ceylan::LongFloat Log2E
 The number log_2(e).
CEYLAN_DLL const Ceylan::LongFloat Log10E
 The number log_10(e).
CEYLAN_DLL const Ceylan::LongFloat LogE2
 The number log_e(2) = ln(2).
CEYLAN_DLL const Ceylan::LongFloat LogE10
 The number log_e(10) = ln(10) (used to be the M_LN10 maths.h constant).
CEYLAN_DLL const Ceylan::LongFloat Pi
 The number pi.
CEYLAN_DLL const Ceylan::LongFloat Pi_div_2
 The number pi/2.
CEYLAN_DLL const Ceylan::LongFloat Pi_div_4
 The number pi/4.
CEYLAN_DLL const Ceylan::LongFloat One_div_Pi
 The number 1/pi.
CEYLAN_DLL const Ceylan::LongFloat Two_div_Pi
 The number 2/pi.
CEYLAN_DLL const Ceylan::LongFloat Two_div_sqrt_Pi
 The number 2/sqrt(pi).
CEYLAN_DLL const Ceylan::LongFloat Sqrt_2
 The number sqrt(2).
CEYLAN_DLL const Ceylan::LongFloat One_div_sqrt_2
 The number 1/sqrt(2).
CEYLAN_DLL const Ceylan::LongFloat EpsilonFloat32 = 2.0e-7
 A very small number, used for floating point comparisons: two numbers x and y are deemed equal if | x - y | < EpsilonFloat32.
CEYLAN_DLL const Ceylan::LongFloat EpsilonFloat64 = 1.0e-9
 A very small number, used for floating point comparisons: two numbers x and y are deemed equal if | x - y | < EpsilonFloat64.
CEYLAN_DLL const Ceylan::LongFloat EpsilonLongFloat = 1.0e-11
 A very small number, used for floating point comparisons: two numbers x and y are deemed equal if | x - y | < EpsilonLongFloat.
CEYLAN_DLL const Ceylan::LongFloat Epsilon = EpsilonFloat32
 A very small number, used for floating point comparisons: two numbers x and y are deemed equal if | x - y | < Epsilon.

Detailed Description

Contains all maths-related operations and constants.


Typedef Documentation

Angles, expressed in degrees.

Note:
Degrees typically range in [0;360[.

Definition at line 103 of file CeylanMathsBasic.h.

Angles, expressed in radians.

Note:
Radians typically range in [0;2*Pi[.

Definition at line 113 of file CeylanMathsBasic.h.

Unit for frequencies (Hz).

For example, a periodical event whose frequency is 100 Hz would happen once on each period P = 1/100 s = 10 ms.

Note:
For our needs, it is an integer type.

Definition at line 135 of file CeylanMathsBasic.h.

Generic signed integer data.

Definition at line 82 of file CeylanMathsBasic.h.

Integer percentage values, which should range from 0 to 100, both included.

Definition at line 122 of file CeylanMathsBasic.h.

Ratio unit, should store floating point values between 0 and 1.

Definition at line 143 of file CeylanMathsBasic.h.

Real is the floating-point coordinate used in Ceylan's linear services.

Note:
Float32 corresponds also to GLfloat and GLclampf.

Definition at line 93 of file CeylanMathsBasic.h.


Function Documentation

Ceylan::LongFloat Ceylan::Maths::Abs ( Ceylan::LongFloat  x  ) 

Computes the absolute value of specified argument.

Definition at line 565 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Abs ( Ceylan::Float64  x  ) 

Computes the absolute value of specified argument.

Definition at line 556 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Abs ( Ceylan::Float32  x  ) 

Computes the absolute value of specified argument.

Note:
Disabled since ISO C++ does not support `long long'. Computes the absolute value of specified argument.

Definition at line 539 of file CeylanMathsBasic.cc.

Ceylan::SignedLongInteger Ceylan::Maths::Abs ( Ceylan::SignedLongInteger  x  ) 

Computes the absolute value of specified argument.

Definition at line 518 of file CeylanMathsBasic.cc.

Ceylan::Sint32 Ceylan::Maths::Abs ( Ceylan::Sint32  x  ) 

Computes the absolute value of specified argument.

Definition at line 509 of file CeylanMathsBasic.cc.

Ceylan::Sint16 Ceylan::Maths::Abs ( Ceylan::Sint16  x  ) 

Computes the absolute value of specified argument.

Definition at line 500 of file CeylanMathsBasic.cc.

Ceylan::Sint8 Ceylan::Maths::Abs ( Ceylan::Sint8  x  ) 

Absolute value, polluted by ambiguous calls:

Computes the absolute value of specified argument.

Definition at line 491 of file CeylanMathsBasic.cc.

Referenced by AreEqual(), AreExactlyEqual(), AreRelativelyEqual(), Ceylan::System::getSchedulingGranularity(), and IsNull().

bool Ceylan::Maths::AreEqual ( Ceylan::LongFloat  x,
Ceylan::LongFloat  y,
Ceylan::LongFloat  epsilon 
)

Tells whether x and y are 'equal' as floating point numbers: | x - y | < epsilon.

Definition at line 276 of file CeylanMathsBasic.cc.

References Abs().

bool Ceylan::Maths::AreEqual ( Ceylan::LongFloat  x,
Ceylan::LongFloat  y 
)

Tells whether x and y are 'equal' as floating point numbers: | x - y | < EpsilonLongFloat.

Definition at line 267 of file CeylanMathsBasic.cc.

References Abs(), and EpsilonLongFloat.

bool Ceylan::Maths::AreEqual ( Ceylan::Float64  x,
Ceylan::Float64  y,
Ceylan::Float64  epsilon 
)

Tells whether x and y are 'equal' as floating point numbers: | x - y | < epsilon.

Definition at line 245 of file CeylanMathsBasic.cc.

References Abs().

bool Ceylan::Maths::AreEqual ( Ceylan::Float64  x,
Ceylan::Float64  y 
)

Tells whether x and y are 'equal' as floating point numbers: | x - y | < EpsilonFloat64.

Definition at line 236 of file CeylanMathsBasic.cc.

References Abs(), and EpsilonFloat64.

bool Ceylan::Maths::AreEqual ( Ceylan::Float32  x,
Ceylan::Float32  y,
Ceylan::Float32  epsilon 
)

Tells whether x and y are 'equal' as floating point numbers: | x - y | < epsilon.

Definition at line 226 of file CeylanMathsBasic.cc.

References Abs().

bool Ceylan::Maths::AreEqual ( Ceylan::Float32  x,
Ceylan::Float32  y 
)

Tells whether x and y are 'equal' as floating point numbers: | x - y | < EpsilonFloat32.

Definition at line 217 of file CeylanMathsBasic.cc.

References Abs(), and EpsilonFloat32.

bool Ceylan::Maths::AreExactlyEqual ( Ceylan::Float64  x,
Ceylan::Float64  y 
)

Tells whether x and y are exactly 'equal': x == y, with no compile warning about the fact that comparing floating point values with == operator is most of the time absurd, which is true indeed.

Note:
Only to be used on special cases where one wants bit-per-bit comparison, for example for marshalling tests. Hence usually using this function is a mistake, as comparing floating point with == or != is unsafe.

Definition at line 255 of file CeylanMathsBasic.cc.

References Abs(), and EpsilonLongFloat.

template<typename T >
bool Ceylan::Maths::AreRelativelyEqual ( x,
y,
Ceylan::LongFloat  epsilon 
) [inline]

Relative comparison with user-supplied epsilon.

Note:
When the values to compare are integers, it is generally useful to use a floating-point type for typename T, for example Ceylan:Float32, to avoid ambiguity with the Abs call. So in all cases T is expected to be a floating-point value.
Parameters:
x the first value to compare.
y the second value to compare.
epsilon the criterion of relative equality.

Definition at line 547 of file CeylanMathsBasic.h.

References Abs(), and IsNull().

template<typename T >
bool Ceylan::Maths::AreRelativelyEqual ( x,
y 
) [inline]

Relative comparison.

Note:
When the values to compare are integers, it is generally useful to use a floating-point type for typename T, for example Ceylan:Float32, to avoid ambiguity with the Abs call. So in all cases T is expected to be a floating-point value.
Parameters:
x the first value to compare.
y the second value to compare.
Note:
The chosen epsilon, the criterion of relative equality, is the default epsilon used for the templated type for tests against zero, and EpsilonFloat32 for the relative test.

Definition at line 491 of file CeylanMathsBasic.h.

References Abs(), EpsilonFloat32, and IsNull().

Ceylan::LongFloat Ceylan::Maths::Ceil ( Ceylan::LongFloat  x  ) 

Definition at line 358 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Ceil ( Ceylan::Float64  x  ) 

Definition at line 349 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Ceil ( Ceylan::Float32  x  ) 

Definition at line 332 of file CeylanMathsBasic.cc.

Ceylan::LongFloat Ceylan::Maths::Cos ( Ceylan::LongFloat  angle  ) 

Computes the cosine of 'angle', where angle is given in radians.

Returns:
a value between -1 and 1.

Definition at line 1021 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Cos ( Ceylan::Float64  angle  ) 

Computes the cosine of 'angle', where angle is given in radians.

Returns:
a value between -1 and 1.

Definition at line 1012 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Cos ( Ceylan::Float32  angle  ) 

Computes the cosine of 'angle', where angle is given in radians.

Returns:
a value between -1 and 1.
Note:
Uses a look-up table on the ARM9 Nintendo DS.

Definition at line 985 of file CeylanMathsBasic.cc.

References dataUtils::c, and Pi.

Referenced by Ceylan::Maths::Linear::Rotation3DFunctor::operator()(), and Ceylan::Maths::Linear::Rotation2DFunctor::operator()().

AngleInRadians Ceylan::Maths::DegreeToRadian ( AngleInDegrees  angleInDegrees  ) 

Converts an angle expressed in degrees into an angle expressed in radians.

Definition at line 1183 of file CeylanMathsBasic.cc.

References Pi.

Referenced by Ceylan::Maths::Linear::Rotation2DFunctor::Rotation2DFunctor(), and Ceylan::Maths::Linear::Rotation3DFunctor::Rotation3DFunctor().

Ceylan::LongFloat Ceylan::Maths::Exp ( Ceylan::LongFloat  x  ) 

Computes the value of e (the base of natural logarithms) raised to the power of x.

Definition at line 825 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Exp ( Ceylan::Float64  x  ) 

Computes the value of e (the base of natural logarithms) raised to the power of x.

Definition at line 816 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Exp ( Ceylan::Float32  x  ) 

Computes the value of e (the base of natural logarithms) raised to the power of x.

Definition at line 799 of file CeylanMathsBasic.cc.

Referenced by Ceylan::Maths::Random::NormalProbabilityFunction::operator()().

Ceylan::LongFloat Ceylan::Maths::Floor ( Ceylan::LongFloat  x  ) 

Definition at line 323 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Floor ( Ceylan::Float64  x  ) 

Definition at line 314 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Floor ( Ceylan::Float32  x  ) 

Definition at line 287 of file CeylanMathsBasic.cc.

bool Ceylan::Maths::IsAPowerOfTwo ( Ceylan::Uint16  value  ) 

Tells whether the specified value is a power of two.

Definition at line 1209 of file CeylanMathsBasic.cc.

References NextPowerOfTwo().

bool Ceylan::Maths::IsNull ( Ceylan::LongFloat  x,
Ceylan::LongFloat  epsilon 
)

Tells whether x is null as regard to floating point numbers: | x | < epsilon.

Definition at line 204 of file CeylanMathsBasic.cc.

References Abs().

bool Ceylan::Maths::IsNull ( Ceylan::LongFloat  x  ) 

Tells whether x is null as regard to floating point numbers: | x | < EpsilonLongFloat.

Definition at line 195 of file CeylanMathsBasic.cc.

References Abs(), and EpsilonLongFloat.

bool Ceylan::Maths::IsNull ( Ceylan::Float64  x,
Ceylan::Float64  epsilon 
)

Tells whether x is null as regard to floating point numbers: | x | < epsilon.

Definition at line 186 of file CeylanMathsBasic.cc.

References Abs().

bool Ceylan::Maths::IsNull ( Ceylan::Float64  x  ) 

Tells whether x is null as regard to floating point numbers: | x | < EpsilonFloat64.

Definition at line 177 of file CeylanMathsBasic.cc.

References Abs(), and EpsilonFloat64.

bool Ceylan::Maths::IsNull ( Ceylan::Float32  x,
Ceylan::Float32  epsilon 
)

Tells whether x is null as regard to floating point numbers: | x | < epsilon.

Definition at line 167 of file CeylanMathsBasic.cc.

References Abs().

bool Ceylan::Maths::IsNull ( Ceylan::Float32  x  ) 
Ceylan::LongFloat Ceylan::Maths::Log ( Ceylan::LongFloat  x  ) 

Computes the value of the natural logarithm of argument x.

Note:
The argument must be strictly positive.

Definition at line 922 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Log ( Ceylan::Float64  x  ) 

Computes the value of the natural logarithm of argument x.

Note:
The argument must be strictly positive.

Definition at line 913 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Log ( Ceylan::Float32  x  ) 

Computes the value of the natural logarithm of argument x.

Note:
The argument must be strictly positive.

Definition at line 896 of file CeylanMathsBasic.cc.

Ceylan::LongFloat Ceylan::Maths::Max ( Ceylan::LongFloat  x,
Ceylan::LongFloat  y 
)

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 790 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Max ( Ceylan::Float64  x,
Ceylan::Float64  y 
)

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 781 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Max ( Ceylan::Float32  x,
Ceylan::Float32  y 
)

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.
Disabled since ISO C++ does not support `long long'. Returns the maximum value of specified parameters.
No macro used to avoid nasty side effects.

Definition at line 772 of file CeylanMathsBasic.cc.

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 751 of file CeylanMathsBasic.cc.

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 741 of file CeylanMathsBasic.cc.

Ceylan::Uint32 Ceylan::Maths::Max ( Ceylan::Uint32  x,
Ceylan::Uint32  y 
)

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 732 of file CeylanMathsBasic.cc.

Ceylan::Sint32 Ceylan::Maths::Max ( Ceylan::Sint32  x,
Ceylan::Sint32  y 
)

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 726 of file CeylanMathsBasic.cc.

Ceylan::Uint16 Ceylan::Maths::Max ( Ceylan::Uint16  x,
Ceylan::Uint16  y 
)

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 717 of file CeylanMathsBasic.cc.

Ceylan::Sint16 Ceylan::Maths::Max ( Ceylan::Sint16  x,
Ceylan::Sint16  y 
)

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 708 of file CeylanMathsBasic.cc.

Ceylan::Uint8 Ceylan::Maths::Max ( Ceylan::Uint8  x,
Ceylan::Uint8  y 
)

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 699 of file CeylanMathsBasic.cc.

Ceylan::Sint8 Ceylan::Maths::Max ( Ceylan::Sint8  x,
Ceylan::Sint8  y 
)

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 690 of file CeylanMathsBasic.cc.

template<typename T >
T Ceylan::Maths::Max ( x,
y 
) [inline]

Max:

Max operator template available, since using only specialized Max functions lead to way too many ambiguities and implies several uneasy static_cast.

Definition at line 1167 of file CeylanMathsBasic.h.

Ceylan::LongFloat Ceylan::Maths::Min ( Ceylan::LongFloat  x,
Ceylan::LongFloat  y 
)

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 680 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Min ( Ceylan::Float64  x,
Ceylan::Float64  y 
)

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 671 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Min ( Ceylan::Float32  x,
Ceylan::Float32  y 
)

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.
Disabled since ISO C++ does not support `long long'. Returns the minimum value of specified parameters.
No macro used to avoid nasty side effects.

Definition at line 662 of file CeylanMathsBasic.cc.

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 639 of file CeylanMathsBasic.cc.

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 629 of file CeylanMathsBasic.cc.

Ceylan::Uint32 Ceylan::Maths::Min ( Ceylan::Uint32  x,
Ceylan::Uint32  y 
)

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 620 of file CeylanMathsBasic.cc.

Ceylan::Sint32 Ceylan::Maths::Min ( Ceylan::Sint32  x,
Ceylan::Sint32  y 
)

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 611 of file CeylanMathsBasic.cc.

Ceylan::Uint16 Ceylan::Maths::Min ( Ceylan::Uint16  x,
Ceylan::Uint16  y 
)

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 602 of file CeylanMathsBasic.cc.

Ceylan::Sint16 Ceylan::Maths::Min ( Ceylan::Sint16  x,
Ceylan::Sint16  y 
)

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 593 of file CeylanMathsBasic.cc.

Ceylan::Uint8 Ceylan::Maths::Min ( Ceylan::Uint8  x,
Ceylan::Uint8  y 
)

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 584 of file CeylanMathsBasic.cc.

Ceylan::Sint8 Ceylan::Maths::Min ( Ceylan::Sint8  x,
Ceylan::Sint8  y 
)

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 575 of file CeylanMathsBasic.cc.

template<typename T >
T Ceylan::Maths::Min ( x,
y,
z 
) [inline]

Three-argument Min operator.

Available as a template, since using only specialized Min functions lead to way too many ambiguities and implies several uneasy static_cast.

Definition at line 1010 of file CeylanMathsBasic.h.

References Min().

template<typename T >
T Ceylan::Maths::Min ( x,
y 
) [inline]

Min:

Min operator template available, since using only specialized Min functions lead to way too many ambiguities and implies several uneasy static_cast.

Definition at line 993 of file CeylanMathsBasic.h.

Referenced by Min().

Ceylan::Uint16 Ceylan::Maths::NextMultipleOf ( Uint16  multiple,
Uint16  value 
)

Definition at line 1218 of file CeylanMathsBasic.cc.

Ceylan::Uint16 Ceylan::Maths::NextPowerOfTwo ( Ceylan::Uint16  value  ) 

Returns the first power of 2 greater or equal to the specified value.

Useful for example to compute OpenGL texture sizes.

Parameters:
value for which the smallest power of two must be returned.
Returns:
the smallest power of 2 greater or equal to the specified value.
Note:
No overflow checking is done.

Definition at line 1192 of file CeylanMathsBasic.cc.

Referenced by IsAPowerOfTwo().

Ceylan::LongFloat Ceylan::Maths::Pow ( Ceylan::LongFloat  x,
Ceylan::LongFloat  y 
)

Computes the value of x raised to the power of y.

Definition at line 860 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Pow ( Ceylan::Float64  x,
Ceylan::Float64  y 
)

Computes the value of x raised to the power of y.

Definition at line 851 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Pow ( Ceylan::Float32  x,
Ceylan::Float32  y 
)

Computes the value of x raised to the power of y.

Definition at line 834 of file CeylanMathsBasic.cc.

Referenced by Ceylan::Maths::Random::NormalProbabilityFunction::operator()().

Ceylan::LongFloat Ceylan::Maths::Pow2 ( Ceylan::LongFloat  x  ) 

Computes the value of x² (x*x).

Definition at line 887 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Pow2 ( Ceylan::Float64  x  ) 

Computes the value of x² (x*x).

Definition at line 878 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Pow2 ( Ceylan::Float32  x  ) 

Computes the value of x² (x*x).

Definition at line 869 of file CeylanMathsBasic.cc.

Referenced by Ceylan::Maths::Linear::Bipoint::Distance(), and Ceylan::Maths::Linear::Bipoint::DistancePow2().

Ceylan::LongFloat Ceylan::Maths::Round ( Ceylan::LongFloat  x,
Ceylan::Uint8  precision 
)

Definition at line 478 of file CeylanMathsBasic.cc.

References Round().

Ceylan::LongFloat Ceylan::Maths::Round ( Ceylan::LongFloat  x  ) 

Definition at line 451 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Round ( Ceylan::Float64  x,
Ceylan::Uint8  precision 
)

Definition at line 438 of file CeylanMathsBasic.cc.

References Round().

Ceylan::Float64 Ceylan::Maths::Round ( Ceylan::Float64  x  ) 

Definition at line 411 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Round ( Ceylan::Float32  x,
Ceylan::Uint8  precision 
)

Definition at line 398 of file CeylanMathsBasic.cc.

References Round().

Ceylan::Float32 Ceylan::Maths::Round ( Ceylan::Float32  x  ) 

Definition at line 371 of file CeylanMathsBasic.cc.

Referenced by Round().

Ceylan::LongFloat Ceylan::Maths::Sin ( Ceylan::LongFloat  angle  ) 

Computes the sine of 'angle', where angle is given in radians.

Returns:
a value between -1 and 1.

Definition at line 1070 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Sin ( Ceylan::Float64  angle  ) 

Computes the sine of 'angle', where angle is given in radians.

Returns:
a value between -1 and 1.

Definition at line 1061 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Sin ( Ceylan::Float32  angle  ) 

Computes the sine of 'angle', where angle is given in radians.

Returns:
a value between -1 and 1.
Note:
Uses a look-up table on the ARM9 Nintendo DS.

Definition at line 1034 of file CeylanMathsBasic.cc.

References dataUtils::c, and Pi.

Referenced by Ceylan::Maths::Linear::Rotation3DFunctor::operator()(), and Ceylan::Maths::Linear::Rotation2DFunctor::operator()().

Ceylan::LongFloat Ceylan::Maths::Sqrt ( Ceylan::LongFloat  x  ) 

Computes the non-negative square root of x.

Exceptions:
MathsException if x is negative.

Definition at line 967 of file CeylanMathsBasic.cc.

References Ceylan::toString().

Ceylan::Float64 Ceylan::Maths::Sqrt ( Ceylan::Float64  x  ) 

Computes the non-negative square root of x.

Exceptions:
MathsException if x is negative.

Definition at line 953 of file CeylanMathsBasic.cc.

References Ceylan::toString().

Ceylan::Float32 Ceylan::Maths::Sqrt ( Ceylan::Float32  x  ) 
Ceylan::LongFloat Ceylan::Maths::Tan ( Ceylan::LongFloat  angle  ) 

Computes the tangent of 'angle', where angle is given in radians.

Returns:
the tangent.

Definition at line 1120 of file CeylanMathsBasic.cc.

Ceylan::Float64 Ceylan::Maths::Tan ( Ceylan::Float64  angle  ) 

Computes the tangent of 'angle', where angle is given in radians.

Returns:
the tangent.

Definition at line 1111 of file CeylanMathsBasic.cc.

Ceylan::Float32 Ceylan::Maths::Tan ( Ceylan::Float32  angle  ) 

Computes the tangent of 'angle', where angle is given in radians.

Returns:
the tangent.
Note:
Uses a look-up table on the ARM9 Nintendo DS.

Definition at line 1084 of file CeylanMathsBasic.cc.

References dataUtils::c, and Pi.


Variable Documentation

Initial value:
    2.7182818284590452353602874713526625L

The number e.

(used to be the M_E maths.h constant).

Definition at line 81 of file CeylanMathsBasic.cc.

A very small number, used for floating point comparisons: two numbers x and y are deemed equal if | x - y | < Epsilon.

Definition at line 149 of file CeylanMathsBasic.cc.

A very small number, used for floating point comparisons: two numbers x and y are deemed equal if | x - y | < EpsilonFloat32.

Definition at line 143 of file CeylanMathsBasic.cc.

Referenced by AreEqual(), AreRelativelyEqual(), and IsNull().

A very small number, used for floating point comparisons: two numbers x and y are deemed equal if | x - y | < EpsilonFloat64.

Definition at line 145 of file CeylanMathsBasic.cc.

Referenced by AreEqual(), and IsNull().

A very small number, used for floating point comparisons: two numbers x and y are deemed equal if | x - y | < EpsilonLongFloat.

Definition at line 147 of file CeylanMathsBasic.cc.

Referenced by AreEqual(), AreExactlyEqual(), and IsNull().

Initial value:
 
    0.4342944819032518276511289189166051L

The number log_10(e).

(used to be the M_LOG10E maths.h constant).

Definition at line 89 of file CeylanMathsBasic.cc.

Initial value:
 
    1.4426950408889634073599246810018922L

The number log_2(e).

(used to be the M_LOG2E maths.h constant).

Definition at line 85 of file CeylanMathsBasic.cc.

Initial value:
 
    2.3025850929940456840179914546843642L

The number log_e(10) = ln(10) (used to be the M_LN10 maths.h constant).

Definition at line 97 of file CeylanMathsBasic.cc.

Initial value:
 
    0.6931471805599453094172321214581766L

The number log_e(2) = ln(2).

(used to be the M_LN2 maths.h constant).

Definition at line 93 of file CeylanMathsBasic.cc.

Initial value:
 
    0.3183098861837906715377675267450287L

The number 1/pi.

(used to be the M_1_PI maths.h constant).

Definition at line 113 of file CeylanMathsBasic.cc.

Initial value:
 
    0.7071067811865475244008443621048490L

The number 1/sqrt(2).

(used to be the M_SQRT1_2 maths.h constant).

Definition at line 129 of file CeylanMathsBasic.cc.

Initial value:
 
    3.1415926535897932384626433832795029L

The number pi.

(used to be the M_PI maths.h constant).

Definition at line 101 of file CeylanMathsBasic.cc.

Referenced by Cos(), DegreeToRadian(), Ceylan::Maths::Random::NormalProbabilityFunction::operator()(), Sin(), and Tan().

Initial value:
 
    1.5707963267948966192313216916397514L

The number pi/2.

(used to be the M_PI_2 maths.h constant).

Definition at line 105 of file CeylanMathsBasic.cc.

Initial value:
 
    0.7853981633974483096156608458198757L

The number pi/4.

(used to be the M_PI_4 maths.h constant).

Definition at line 109 of file CeylanMathsBasic.cc.

Initial value:
 
    1.4142135623730950488016887242096981L

The number sqrt(2).

(used to be the M_SQRT2 maths.h constant).

Definition at line 125 of file CeylanMathsBasic.cc.

Initial value:
 
    0.6366197723675813430755350534900574L

The number 2/pi.

(used to be the M_2_PI maths.h constant).

Definition at line 117 of file CeylanMathsBasic.cc.

Initial value:
 
    1.1283791670955125738961589031215452L

The number 2/sqrt(pi).

(used to be the M_2_SQRTPI maths.h constant).

Definition at line 121 of file CeylanMathsBasic.cc.

Generated on Mon Nov 29 13:41:18 2010 for Ceylan by  doxygen 1.6.3