INET Framework for OMNeT++/OMNEST
|
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 bool | close (double one, double two) |
static int | stepfunction (double i) |
static int | sign (double i) |
static int | round (double d) |
static double | max (double a, double b) |
static double | dBm2mW (double dBm) |
Support functions for mathematical operations.
This class contains all kind of mathematical support functions
static bool FWMath::close | ( | double | one, |
double | two | ||
) | [inline, static] |
Tests whether two doubles are close enough to be declared equal.
{ return fabs(one-two)<EPSILON; }
static double FWMath::dBm2mW | ( | double | dBm | ) | [inline, static] |
convert a dBm value into milli Watt
Referenced by SnrEval::initialize(), SnrDecider::initialize(), and AbstractRadio::initialize().
{
return pow(10.0, dBm/10.0);
}
static double FWMath::div | ( | double | dividend, |
double | divisor | ||
) | [inline, static] |
Returns the result of a whole-numbered division.
{ double i; modf(dividend/divisor, &i); return i; }
static double FWMath::max | ( | double | a, |
double | b | ||
) | [inline, static] |
{ return (a<b)? b : a; }
static double FWMath::mod | ( | double | dividend, |
double | divisor | ||
) | [inline, static] |
Returns the rest of a whole-numbered division.
{ double i; return modf(dividend/divisor, &i)*divisor; }
static int FWMath::round | ( | double | d | ) | [inline, static] |
Referenced by ConstSpeedMobility::setTargetPosition().
{ return (int)(ceil(d-0.5)); }
static int FWMath::sign | ( | double | i | ) | [inline, static] |
{ return (i>=0)? 1 : -1; };
static int FWMath::stepfunction | ( | double | i | ) | [inline, static] |