juce_MathsFunctions.h File Reference


Defines

#define literal64bit(longLiteral)   (longLiteral##LL)
 A platform-independent macro for writing 64-bit literals, needed because different compilers have different syntaxes for this.
#define numElementsInArray(a)   ((int) (sizeof (a) / sizeof ((a)[0])))
 Handy macro for getting the number of elements in a simple const C array.
#define juce_isfinite(v)   std::isfinite(v)
 The isfinite() method seems to vary greatly between platforms, so this is a platform-independent macro for it.

Typedefs

typedef signed char int8
 A platform-independent 8-bit signed integer type.
typedef unsigned char uint8
 A platform-independent 8-bit unsigned integer type.
typedef signed short int16
 A platform-independent 16-bit signed integer type.
typedef unsigned short uint16
 A platform-independent 16-bit unsigned integer type.
typedef signed int int32
 A platform-independent 32-bit signed integer type.
typedef unsigned int uint32
 A platform-independent 32-bit unsigned integer type.
typedef long long int64
 A platform-independent 64-bit integer type.
typedef unsigned long long uint64
 A platform-independent 64-bit unsigned integer type.
typedef int pointer_sized_int
 A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it.
typedef unsigned int pointer_sized_uint
 An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it.
typedef wchar_t juce_wchar
 A platform-independent unicode character type.

Functions

forcedinline int jmax (const int a, const int b) throw ()
 Returns the larger of two values.
forcedinline int64 jmax (const int64 a, const int64 b) throw ()
 Returns the larger of two values.
forcedinline float jmax (const float a, const float b) throw ()
 Returns the larger of two values.
forcedinline double jmax (const double a, const double b) throw ()
 Returns the larger of two values.
int jmax (const int a, const int b, const int c) throw ()
 Returns the larger of three values.
int64 jmax (const int64 a, const int64 b, const int64 c) throw ()
 Returns the larger of three values.
float jmax (const float a, const float b, const float c) throw ()
 Returns the larger of three values.
double jmax (const double a, const double b, const double c) throw ()
 Returns the larger of three values.
int jmax (const int a, const int b, const int c, const int d) throw ()
 Returns the larger of four values.
int64 jmax (const int64 a, const int64 b, const int64 c, const int64 d) throw ()
 Returns the larger of four values.
float jmax (const float a, const float b, const float c, const float d) throw ()
 Returns the larger of four values.
double jmax (const double a, const double b, const double c, const double d) throw ()
 Returns the larger of four values.
int jmin (const int a, const int b) throw ()
 Returns the smaller of two values.
int64 jmin (const int64 a, const int64 b) throw ()
 Returns the smaller of two values.
float jmin (const float a, const float b) throw ()
 Returns the smaller of two values.
double jmin (const double a, const double b) throw ()
 Returns the smaller of two values.
int jmin (const int a, const int b, const int c) throw ()
 Returns the smaller of three values.
int64 jmin (const int64 a, const int64 b, const int64 c) throw ()
 Returns the smaller of three values.
float jmin (const float a, const float b, const float c) throw ()
 Returns the smaller of three values.
double jmin (const double a, const double b, const double c) throw ()
 Returns the smaller of three values.
int jmin (const int a, const int b, const int c, const int d) throw ()
 Returns the smaller of four values.
int64 jmin (const int64 a, const int64 b, const int64 c, const int64 d) throw ()
 Returns the smaller of four values.
float jmin (const float a, const float b, const float c, const float d) throw ()
 Returns the smaller of four values.
double jmin (const double a, const double b, const double c, const double d) throw ()
 Returns the smaller of four values.
template<class Type >
Type jlimit (const Type lowerLimit, const Type upperLimit, const Type valueToConstrain) throw ()
 Constrains a value to keep it within a given range.
template<class Type >
void swapVariables (Type &variable1, Type &variable2) throw ()
 Handy function to swap two values over.
forcedinline double juce_hypot (double a, double b)
 Using juce_hypot and juce_hypotf is easier than dealing with all the different versions of these functions of various platforms and compilers.
forcedinline float juce_hypotf (float a, float b)
 Using juce_hypot and juce_hypotf is easier than dealing with all the different versions of these functions of various platforms and compilers.
int64 abs64 (const int64 n) throw ()

Variables

const double double_Pi = 3.1415926535897932384626433832795
 A predefined value for Pi, at double-precision.
const float float_Pi = 3.14159265358979323846f
 A predefined value for Pi, at sngle-precision.

Define Documentation

#define literal64bit ( longLiteral   )     (longLiteral##LL)

A platform-independent macro for writing 64-bit literals, needed because different compilers have different syntaxes for this.

E.g. writing literal64bit (0x1000000000) will translate to 0x1000000000LL for GCC, or 0x1000000000 for MSVC.

#define numElementsInArray (  )     ((int) (sizeof (a) / sizeof ((a)[0])))

Handy macro for getting the number of elements in a simple const C array.

E.g.

    static int myArray[] = { 1, 2, 3 };

    int numElements = numElementsInArray (myArray) // returns 3

#define juce_isfinite (  )     std::isfinite(v)

The isfinite() method seems to vary greatly between platforms, so this is a platform-independent macro for it.


Typedef Documentation

typedef signed char int8

A platform-independent 8-bit signed integer type.

typedef unsigned char uint8

A platform-independent 8-bit unsigned integer type.

typedef signed short int16

A platform-independent 16-bit signed integer type.

typedef unsigned short uint16

A platform-independent 16-bit unsigned integer type.

typedef signed int int32

A platform-independent 32-bit signed integer type.

typedef unsigned int uint32

A platform-independent 32-bit unsigned integer type.

typedef long long int64

A platform-independent 64-bit integer type.

typedef unsigned long long uint64

A platform-independent 64-bit unsigned integer type.

typedef int pointer_sized_int

A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it.

typedef unsigned int pointer_sized_uint

An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it.

typedef wchar_t juce_wchar

A platform-independent unicode character type.


Function Documentation

forcedinline int jmax ( const int  a,
const int  b 
) throw ()

forcedinline int64 jmax ( const int64  a,
const int64  b 
) throw ()

Returns the larger of two values.

forcedinline float jmax ( const float  a,
const float  b 
) throw ()

Returns the larger of two values.

forcedinline double jmax ( const double  a,
const double  b 
) throw ()

Returns the larger of two values.

int jmax ( const int  a,
const int  b,
const int  c 
) throw ()

Returns the larger of three values.

int64 jmax ( const int64  a,
const int64  b,
const int64  c 
) throw ()

Returns the larger of three values.

float jmax ( const float  a,
const float  b,
const float  c 
) throw ()

Returns the larger of three values.

double jmax ( const double  a,
const double  b,
const double  c 
) throw ()

Returns the larger of three values.

int jmax ( const int  a,
const int  b,
const int  c,
const int  d 
) throw ()

Returns the larger of four values.

References jmax().

int64 jmax ( const int64  a,
const int64  b,
const int64  c,
const int64  d 
) throw ()

Returns the larger of four values.

References jmax().

float jmax ( const float  a,
const float  b,
const float  c,
const float  d 
) throw ()

Returns the larger of four values.

References jmax().

double jmax ( const double  a,
const double  b,
const double  c,
const double  d 
) throw ()

Returns the larger of four values.

References jmax().

int jmin ( const int  a,
const int  b 
) throw ()

int64 jmin ( const int64  a,
const int64  b 
) throw ()

Returns the smaller of two values.

float jmin ( const float  a,
const float  b 
) throw ()

Returns the smaller of two values.

double jmin ( const double  a,
const double  b 
) throw ()

Returns the smaller of two values.

int jmin ( const int  a,
const int  b,
const int  c 
) throw ()

Returns the smaller of three values.

int64 jmin ( const int64  a,
const int64  b,
const int64  c 
) throw ()

Returns the smaller of three values.

float jmin ( const float  a,
const float  b,
const float  c 
) throw ()

Returns the smaller of three values.

double jmin ( const double  a,
const double  b,
const double  c 
) throw ()

Returns the smaller of three values.

int jmin ( const int  a,
const int  b,
const int  c,
const int  d 
) throw ()

Returns the smaller of four values.

References jmin().

int64 jmin ( const int64  a,
const int64  b,
const int64  c,
const int64  d 
) throw ()

Returns the smaller of four values.

References jmin().

float jmin ( const float  a,
const float  b,
const float  c,
const float  d 
) throw ()

Returns the smaller of four values.

References jmin().

double jmin ( const double  a,
const double  b,
const double  c,
const double  d 
) throw ()

Returns the smaller of four values.

References jmin().

template<class Type >
Type jlimit ( const Type  lowerLimit,
const Type  upperLimit,
const Type  valueToConstrain 
) throw ()

Constrains a value to keep it within a given range.

This will check that the specified value lies between the lower and upper bounds specified, and if not, will return the nearest value that would be in-range. Effectively, it's like calling jmax (lowerLimit, jmin (upperLimit, value)).

Note that it expects that lowerLimit <= upperLimit. If this isn't true, the results will be unpredictable.

Parameters:
lowerLimit the minimum value to return
upperLimit the maximum value to return
valueToConstrain the value to try to return
Returns:
the closest value to valueToConstrain which lies between lowerLimit and upperLimit (inclusive)
See also:
jlimit0To, jmin, jmax

References jassert.

Referenced by ReferenceCountedArray< SynthesiserSound >::removeRange(), OwnedArray< MidiBuffer >::removeRange(), Array< Thread::ThreadID >::removeRange(), and CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().

template<class Type >
void swapVariables ( Type &  variable1,
Type &  variable2 
) throw ()

forcedinline double juce_hypot ( double  a,
double  b 
)

Using juce_hypot and juce_hypotf is easier than dealing with all the different versions of these functions of various platforms and compilers.

forcedinline float juce_hypotf ( float  a,
float  b 
)

Using juce_hypot and juce_hypotf is easier than dealing with all the different versions of these functions of various platforms and compilers.

int64 abs64 ( const int64  n  )  throw ()


Variable Documentation

const double double_Pi = 3.1415926535897932384626433832795

A predefined value for Pi, at double-precision.

See also:
float_Pi

const float float_Pi = 3.14159265358979323846f

A predefined value for Pi, at sngle-precision.

See also:
double_Pi


Generated on Fri Nov 20 12:00:39 2009 for JUCE by  doxygen 1.5.9