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 = 1.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 551 of file CeylanMathsBasic.cc.

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

Computes the absolute value of specified argument.

Definition at line 542 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 525 of file CeylanMathsBasic.cc.

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

Computes the absolute value of specified argument.

Definition at line 504 of file CeylanMathsBasic.cc.

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

Computes the absolute value of specified argument.

Definition at line 495 of file CeylanMathsBasic.cc.

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

Computes the absolute value of specified argument.

Definition at line 486 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 477 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 262 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 253 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 231 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 222 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 212 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 203 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 241 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:
Not that useful, since compilers usually complain about an ambiguous call of overloaded `Abs(...)', which should be templated too.
Parameters:
x the first value to compare.
y the second value to compare.
epsilon the double of the criterion of relative equality.

Definition at line 537 of file CeylanMathsBasic.h.

References Abs(), and IsNull().

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

Relative comparison.

Note:
Not that useful, since compilers usually complain about an ambiguous call of overloaded `Abs(...)', which should be templated too.
Parameters:
x the first value to compare.
y the second value to compare.
Note:
The chosen epsilon, the double of 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 489 of file CeylanMathsBasic.h.

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

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

Definition at line 344 of file CeylanMathsBasic.cc.

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

Definition at line 335 of file CeylanMathsBasic.cc.

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

Definition at line 318 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 1007 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 998 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 971 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 1169 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 811 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 802 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 785 of file CeylanMathsBasic.cc.

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

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

Definition at line 309 of file CeylanMathsBasic.cc.

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

Definition at line 300 of file CeylanMathsBasic.cc.

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

Definition at line 273 of file CeylanMathsBasic.cc.

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

Tells whether the specified value is a power of two.

Definition at line 1195 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 190 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 181 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 172 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 163 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 153 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 908 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 899 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 882 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 776 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 767 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 758 of file CeylanMathsBasic.cc.

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 737 of file CeylanMathsBasic.cc.

Returns the maximum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 727 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 718 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 712 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 703 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 694 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 685 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 676 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 1151 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 666 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 657 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 648 of file CeylanMathsBasic.cc.

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 625 of file CeylanMathsBasic.cc.

Returns the minimum value of specified parameters.

Note:
No macro used to avoid nasty side effects.

Definition at line 615 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 606 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 597 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 588 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 579 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 570 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 561 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 994 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 977 of file CeylanMathsBasic.h.

Referenced by Min().

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

Definition at line 1204 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 1178 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 846 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 837 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 820 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 873 of file CeylanMathsBasic.cc.

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

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

Definition at line 864 of file CeylanMathsBasic.cc.

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

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

Definition at line 855 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 464 of file CeylanMathsBasic.cc.

References Round().

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

Definition at line 437 of file CeylanMathsBasic.cc.

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

Definition at line 424 of file CeylanMathsBasic.cc.

References Round().

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

Definition at line 397 of file CeylanMathsBasic.cc.

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

Definition at line 384 of file CeylanMathsBasic.cc.

References Round().

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

Definition at line 357 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 1056 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 1047 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 1020 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 953 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 939 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 1106 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 1097 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 1070 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 136 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 133 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 134 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 135 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 128 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 Thu Jun 4 20:40:30 2009 for Ceylan by  doxygen 1.5.8