INET Framework for OMNeT++/OMNEST
INETMath.h File Reference
#include <cmath>
#include <limits>
#include "inet/common/INETDefs.h"

Namespaces

 inet
 Copyright (c) 2005 Jan Ringo�, www.ringos.cz.
 
 inet::math
 Support functions for mathematical operations.
 

Macros

#define M_E   2.7182818284590452354
 
#define M_LOG2E   1.4426950408889634074
 
#define M_LOG10E   0.43429448190325182765
 
#define M_LN2   0.69314718055994530942
 
#define M_LN10   2.30258509299404568402
 
#define M_PI   3.14159265358979323846
 
#define M_PI_2   1.57079632679489661923
 
#define M_PI_4   0.78539816339744830962
 
#define M_1_PI   0.31830988618379067154
 
#define M_2_PI   0.63661977236758134308
 
#define M_2_SQRTPI   1.12837916709551257390
 
#define M_SQRT2   1.41421356237309504880
 
#define M_SQRT1_2   0.70710678118654752440
 
#define EPSILON   0.001
 
#define qNaN   std::numeric_limits<double>::quiet_NaN()
 
#define sNaN   std::numeric_limits<double>::signaling_NaN()
 
#define NaN   qNaN
 

Functions

double inet::math::mod (double dividend, double divisor)
 Returns the rest of a whole-numbered division. More...
 
double inet::math::div (double dividend, double divisor)
 Returns the result of a whole-numbered division. More...
 
double inet::math::modulo (double a, double n)
 Returns the remainder r on division of dividend a by divisor n, using floored division. More...
 
bool inet::math::close (double one, double two)
 Tests whether two doubles are close enough to be declared equal. More...
 
int inet::math::stepfunction (double i)
 Returns 0 if i is close to 0, 1 if i is positive and greater than epsilon, or -1 if it is negative and less than epsilon. More...
 
int inet::math::sign (double i)
 Returns 1 if the parameter is greater or equal to zero, -1 otherwise. More...
 
int inet::math::round (double d)
 Returns an integer that corresponds to rounded double parameter. More...
 
double inet::math::floorToZero (double d)
 Discards the fractional part of the parameter, e.g. More...
 
double inet::math::max (double a, double b)
 Returns the greater of the given parameters. More...
 
double inet::math::dB2fraction (double dB)
 Converts a dB value to fraction. More...
 
double inet::math::fraction2dB (double fraction)
 Convert a fraction value to dB. More...
 
double inet::math::dBm2mW (double dBm)
 Converts a dBm value into milliwatts. More...
 
double inet::math::mW2dBm (double mW)
 Convert a mW value to dBm. More...
 
double inet::math::deg2rad (double deg)
 Convert a degree value to radian. More...
 
double inet::math::rad2deg (double rad)
 Convert a radian value to degree. More...
 
double inet::math::n_choose_k (int n, int k)
 Implementation of the n choose k (binomial coefficient) function, from the MiXiM Framework Author Karl Wessel. More...
 

Macro Definition Documentation

#define EPSILON   0.001
#define M_1_PI   0.31830988618379067154
#define M_2_PI   0.63661977236758134308
#define M_2_SQRTPI   1.12837916709551257390
#define M_E   2.7182818284590452354
#define M_LN10   2.30258509299404568402
#define M_LN2   0.69314718055994530942
#define M_LOG10E   0.43429448190325182765
#define M_LOG2E   1.4426950408889634074
#define M_PI   3.14159265358979323846
#define M_PI_2   1.57079632679489661923
#define M_PI_4   0.78539816339744830962
#define M_SQRT1_2   0.70710678118654752440
#define M_SQRT2   1.41421356237309504880
#define NaN   qNaN

Referenced by inet::physicallayer::Ieee80211ErrorModelBase::computeBitErrorRate(), inet::physicallayer::Ieee80211BerTableErrorModel::computeBitErrorRate(), inet::physicallayer::DimensionalTransmission::computeMinPower(), inet::physicallayer::Ieee80211OFDMErrorModel::computePacketModel(), inet::physicallayer::TwoRayInterference::computePathLoss(), inet::physicallayer::TwoRayInterference::computeRange(), inet::physicallayer::SUIPathLoss::computeRange(), inet::physicallayer::UWBIRStochasticPathLoss::computeRange(), inet::physicallayer::IdealAnalogModel::computeReception(), inet::physicallayer::APSKLayeredReceiver::computeReceptionResult(), inet::physicallayer::Ieee80211ErrorModelBase::computeSymbolErrorRate(), inet::physicallayer::Ieee80211BerTableErrorModel::computeSymbolErrorRate(), inet::physicallayer::Ieee80211LayeredOFDMReceiver::createCompletePacketModel(), inet::physicallayer::Ieee80211LayeredOFDMReceiver::createDataFieldBitModel(), inet::physicallayer::Ieee80211LayeredOFDMTransmitter::createDataFieldPacketModel(), inet::physicallayer::Ieee80211LayeredOFDMReceiver::createDataFieldSymbolModel(), inet::physicallayer::Ieee80211OFDMDecoder::createPacketModel(), inet::physicallayer::Ieee80211LayeredOFDMReceiver::createSignalFieldBitModel(), inet::physicallayer::Ieee80211LayeredOFDMTransmitter::createSignalFieldPacketModel(), inet::physicallayer::Ieee80211LayeredOFDMReceiver::createSignalFieldSymbolModel(), inet::physicallayer::APSKLayeredTransmitter::createSymbolModel(), inet::physicallayer::Ieee80211LayeredOFDMTransmitter::createSymbolModel(), inet::physicallayer::APSKDecoder::decode(), inet::physicallayer::APSKDemodulator::demodulate(), inet::physicallayer::Ieee80211OFDMDemodulator::demodulate(), inet::physicallayer::PulseFilter::filter(), inet::physicalenvironment::MaterialRegistry::getMaterial(), inet::physicallayer::TransmitterBase::getMaxCommunicationRange(), inet::physicallayer::APSKLayeredTransmitter::getMaxCommunicationRange(), inet::physicallayer::Ieee80211LayeredOFDMTransmitter::getMaxCommunicationRange(), inet::physicallayer::TransmitterBase::getMaxInterferenceRange(), inet::physicallayer::APSKLayeredTransmitter::getMaxInterferenceRange(), inet::physicallayer::Ieee80211LayeredOFDMTransmitter::getMaxInterferenceRange(), inet::physicallayer::TransmitterBase::getMaxPower(), inet::RandomWPMobility::getMaxSpeed(), inet::MassMobility::getMaxSpeed(), inet::MobilityBase::getMaxSpeed(), inet::physicallayer::IdealSNIR::getMin(), inet::physicallayer::ReceiverBase::getMinInterferencePower(), inet::physicallayer::ReceiverBase::getMinReceptionPower(), inet::PositionTable::getPosition(), inet::GPSR::intersectSections(), inet::visualizer::NetworkNodeCanvasVisualization::layout(), inet::physicallayer::APSKModulator::modulate(), inet::physicallayer::Ieee80211OFDMModulator::modulate(), inet::visualizer::StatisticVisualizerBase::receiveSignal(), inet::MobilityBase::reflectIfOutside(), and inet::power::SimpleEpEnergyManagement::scheduleLifecycleOperationTimer().

#define qNaN   std::numeric_limits<double>::quiet_NaN()
#define sNaN   std::numeric_limits<double>::signaling_NaN()