|
static double | GetPI () |
| Get the PI constant.
|
|
static double | GetE () |
| Get the E constant.
|
|
static MVariant | Min (const MVariant &v1, const MVariant &v2) |
| Returns the smaller of the two two given parameters. More...
|
|
static MVariant | Max (const MVariant &v1, const MVariant &v2) |
| Returns the bigger of the two given parameters. More...
|
|
static MVariant | Abs (const MVariant &num) |
| Returns the absolute value of the given parameter. More...
|
|
static double | Floor (double num) |
| Returns the closest from the left integer number to a given double precision floating point number. More...
|
|
static double | Ceil (double num) |
| Returns the closest from the right integer number to a given double precision floating point number. More...
|
|
static double | Round0 (double val) |
| Round the floating point value to the nearest whole number. More...
|
|
static double | Round (double val, int numDecimalPlaces=0) |
| Round the floating point number to the given decimal digits after comma. More...
|
|
static int | RoundUpToPowerOfTwo (int x) |
| Round a given integer number to the nearest power of two, which is bigger or equal to the initial number. More...
|
|
static unsigned | RoundUpToPowerOfTwo (unsigned x) |
| Round a given unsigned integer number to the nearest power of two, which is bigger or equal to the initial number. More...
|
|
static double | Sqrt (double arg) |
| Returns the square root of the given parameter. More...
|
|
static double | Pow10 (int power) |
| Facility function that efficiently returns the integer power of ten. More...
|
|
static double | Pow2 (int power) |
| Facility function that efficiently returns the integer power of two. More...
|
|
static double | Pow (double x, double y) |
| Value of x raised into power y. More...
|
|
static double | Exp (double num) |
| Returns the base-e exponential function of num, which is e raised to the power num: e^num. More...
|
|
static double | Log (double num) |
| Returns the natural logarithm of the number. More...
|
|
static double | Log10 (double num) |
| Returns the common (base-10) logarithm of num. More...
|
|
static double | Sin (double num) |
| Returns the sine of an angle of num radians. More...
|
|
static double | Cos (double num) |
| Returns the cosine of an angle of num radians. More...
|
|
static double | Tan (double num) |
| Returns the tangent of an angle of num radians. More...
|
|
static double | Asin (double num) |
| Returns the principal value of the arc sine of num, expressed in radians. More...
|
|
static double | Acos (double num) |
| Returns the principal value of the arc cosine of num, expressed in radians. More...
|
|
static double | Atan (double num) |
| Returns the principal value of the arc tangent of x, expressed in radians. More...
|
|
static int | Rand () |
| Pseudo-random integer number in range 0 . More...
|
|
static unsigned | RandomInRange (unsigned minimum, unsigned maximum) |
| Pseudo-random unsigned number within a given inclusive range. More...
|
|
static double | RandomFloat () |
| Returns a pseudo-random double precision floating point number in range [0.0 to 1.0). More...
|
|
static double | RandomFloatInRange (double minimum, double maximum) |
| Convenience function that returns a doubvle precision floating point number within a given range. More...
|
|
static double | BinaryMantissa (double value) |
| Returns the binary mantissa of a given number, range 0.5 to 1.0. More...
|
|
static double | BinaryExponent (double value) |
| Returns the binary exponent of a given number. More...
|
|
static const MClass * | GetStaticClass () |
| Get the declared class of this particular object. More...
|
|
static bool | IsClassPresent (const MStdString &name) |
| Tells if the given class name is available. More...
|
|
|
virtual | ~MObject () |
| Object destructor.
|
|
virtual const MClass * | GetClass () const =0 |
| Get the final class of the object. More...
|
|
virtual unsigned | GetEmbeddedSizeof () const |
| For embedded object types, return the size of the class. More...
|
|
bool | IsEmbeddedObject () const |
| Tell if the object is of embedded kind. More...
|
|
SHOW_INTERNAL MVariant | Call (const MStdString &name, const MVariant ¶ms) |
| Call the object service with parameters, given as variant. More...
|
|
MVariant | Call0 (const MStdString &name) |
| Call the object service with no parameters. More...
|
|
MVariant | Call1 (const MStdString &name, const MVariant &p1) |
| Call the object service with one parameter. More...
|
|
MVariant | Call2 (const MStdString &name, const MVariant &p1, const MVariant &p2) |
| Call the object service with two parameter. More...
|
|
MVariant | Call3 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3) |
| Call the object service with three parameter. More...
|
|
MVariant | Call4 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4) |
| Call the object service with four parameter. More...
|
|
MVariant | Call5 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5) |
| Call the object service with five parameter. More...
|
|
MVariant | Call6 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5, const MVariant &p6) |
| Call the object service with six parameter. More...
|
|
virtual MVariant | CallV (const MStdString &name, const MVariant::VariantVector ¶ms) |
| Call the object service with parameters, given as variant vector. More...
|
|
virtual bool | IsPropertyPresent (const MStdString &name) const |
| Tell if the property with the given name exists.
|
|
virtual bool | IsServicePresent (const MStdString &name) const |
| Tell if the service with the given name exists.
|
|
virtual MVariant | GetProperty (const MStdString &name) const |
| Get the property value using name of the property. More...
|
|
virtual void | SetProperty (const MStdString &name, const MVariant &value) |
| Set the property using name of the property, and value. More...
|
|
virtual MStdStringVector | GetAllPropertyNames () const |
| Return the list of publicly available properties, persistent or not. More...
|
|
virtual MStdStringVector | GetAllPersistentPropertyNames () const |
| Return the list of persistent properties. More...
|
|
virtual void | SetPersistentPropertiesToDefault () |
| Set the persistent properties of the object to their default values. More...
|
|
virtual MVariant | GetPersistentPropertyDefaultValue (const MStdString &name) const |
| Get the default value of persistent property with the name given. More...
|
|
virtual void | SetPersistentPropertyToDefault (const MStdString &name) |
| Set the persistent property with the name given to default value. More...
|
|
virtual const char * | GetType () const |
| Get the name of the type for the object (could be the same as class name).
|
|
virtual void | SetType (const MStdString &) |
| Intentionally, it will set the name of the type for the object, but the service will not allow setting the name to anything other than the current name. More...
|
|
virtual void | Validate () |
| Validate internal structures of the object. More...
|
|
static const MClass | s_class |
| Class of MObject.
|
|
| MObject () |
| Object constructor, protected as the class is abstract.
|
|
void | DoSetPersistentPropertiesToDefault (const MClass *staticClass) |
| Set the persistent properties to their default values for one object provided the class for that object. More...
|
|
MMath is derived from MObject, and it only has static properties and methods.
No instances of the MMath class are possible.
static double MMath::Round |
( |
double |
val, |
|
|
int |
numDecimalPlaces = 0 |
|
) |
| |
|
static |
Round the floating point number to the given decimal digits after comma.
If the number is NaN or any form of infinity, the same value is returned.
Depending on the second parameter:
- Rounding to zero digits after comma is equivalent to rounding to the nearest whole number.
- Rounding to the positive number of digits is done to the nearest number of 1/10 for 1, 1/100 for 2, 1/1000 for 3, and so on.
- Rounding to the negative number of digits is done to the nearest number of tens for 1, hundredths for 2, thousands for 3, and so on.
Rounding of halves is done upwards for positive numbers and downwards for negatives. In detail:
- In case the number is positive, and it ends with x.5, the returned number will be the seiling of the one given so that 1.5 will be rounded up to 2.0, and so on.
- In case the number is negative, and it ends with x.5, the returned number will be the floor of the one given so that -1.5 will be rounded down to -2.0, and so on.
The method attempts to perform the rounding precisely using the rules described above, however since IEEE-754 floating point numbers are binary, their approsimation to decimal cannot always be precise.
- Parameters
-
val | Double precision floating point number to round. |
numDecimalPlaces | Number of decimal places after comma, zero by default. |
- Returns
- Result double precision floating point value approximated to the closest value with the given number of decimal points.
Usage:
static double MMath::Round0 |
( |
double |
val | ) |
|
|
static |
Round the floating point value to the nearest whole number.
If the number is NaN or any form of infinity, the same value is returned.
Rounding of halves is done upwards for positive numbers and downwards for negatives. In detail:
- In case the number is positive, and it ends with x.5, the returned number will be the seiling of the one given so that 1.5 will be rounded up to 2.0, and so on.
- In case the number is negative, and it ends with x.5, the returned number will be the floor of the one given so that -1.5 will be rounded down to -2.0, and so on.
The method attempts to perform the rounding precisely using the rules described above, however since IEEE-754 floating point numbers are binary, their approsimation to decimal cannot always be precise.
- Parameters
-
val | Double precision floating point number to round. |
- Returns
- Result double precision floating point value rounded to the closest whole number.
Usage: