Support functions for mathematical operations. More...
#include <FWMath.h>
Static Public Member Functions | |
static double | mod (double dividend, double divisor) |
static double | div (double dividend, double divisor) |
static double | modulo (double a, double n) |
Returns the remainder r on division of dividend a by divisor n, using floored division. The remainder r has the same sign as the divisor n. | |
static bool | close (double one, double two) |
static int | stepfunction (double i) |
static int | sign (double i) |
static int | round (double d) |
static double | floorToZero (double d) |
static double | max (double a, double b) |
static double | min (double a, double b) |
static double | dBm2mW (double dBm) |
static double | mW2dBm (double mW) |
Convert an mW value to dBm. | |
static double | torDist (double x1, double x2, double y1, double y2) |
static double | erfc (double x) |
Complementary error function. |
Support functions for mathematical operations.
This class contains all kind of mathematical support functions
Definition at line 76 of file FWMath.h.
static bool FWMath::close | ( | double | one, | |
double | two | |||
) | [inline, static] |
Tests whether two doubles are close enough to be declared equal.
Definition at line 112 of file FWMath.h.
Referenced by Move::getPositionAt(), PostureTransition::isMarkovian(), MoBANLocal::receiveBBItem(), Move::setDirectionByTarget(), Move::setDirectionByVector(), and stepfunction().
{
return fabs(one-two)<EPSILON;
}
static double FWMath::dBm2mW | ( | double | dBm | ) | [inline, static] |
convert a dBm value into milli Watt
Definition at line 151 of file FWMath.h.
Referenced by Mac80211::initialize(), BasePhyLayer::initialize(), and LogNormalShadowing::randomLogNormalGain().
{
return pow(10.0, dBm/10.0);
}
static double FWMath::div | ( | double | dividend, | |
double | divisor | |||
) | [inline, static] |
static double FWMath::floorToZero | ( | double | d | ) | [inline, static] |
Definition at line 136 of file FWMath.h.
Referenced by TractorMobility::calculateXY().
{ return (d >= 0.0)? floor(d) : ceil(d); }
static double FWMath::max | ( | double | a, | |
double | b | |||
) | [inline, static] |
Definition at line 141 of file FWMath.h.
Referenced by MoBANCoordinator::readConfigurationFile().
{ return (a<b)? b : a; }
static double FWMath::min | ( | double | a, | |
double | b | |||
) | [inline, static] |
static double FWMath::mod | ( | double | dividend, | |
double | divisor | |||
) | [inline, static] |
static int FWMath::round | ( | double | d | ) | [inline, static] |
Definition at line 131 of file FWMath.h.
Referenced by MoBANCoordinator::mainProcess(), MoBANLocal::setTargetPosition(), and ConstSpeedMobility::setTargetPosition().
{ return (int)(ceil(d-0.5)); }
static int FWMath::sign | ( | double | i | ) | [inline, static] |
static int FWMath::stepfunction | ( | double | i | ) | [inline, static] |
static double FWMath::torDist | ( | double | x1, | |
double | x2, | |||
double | y1, | |||
double | y2 | |||
) | [inline, static] |