Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

FWMath Class Reference

#include <FWMath.h>

List of all members.


Detailed Description

Support functions for mathematical operations.

This class contains all kind of mathematical support functions

Author:
Christian Frank


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)


Member Function Documentation

static bool FWMath::close double  one,
double  two
[inline, static]
 

Tests whether two doubles are close enough to be declared equal.

Returns:
true if parameters are at most epsilon apart, false otherwise
00079                                             {
00080       return fabs(one-two)<EPSILON;
00081   }

static double FWMath::dBm2mW double  dBm  )  [inline, static]
 

convert a dBm value into milli Watt

00108                                   {
00109       return pow(10.0, dBm/10.0);
00110   }

static double FWMath::div double  dividend,
double  divisor
[inline, static]
 

Returns the result of a whole-numbered division.

00067                                                      {
00068       double i;
00069       double f;
00070       f=modf(dividend/divisor, &i);
00071       return i;
00072   }

static double FWMath::max double  a,
double  b
[inline, static]
 

Returns:
greater of the given parameters
00103 { return (a<b)? b : a; }

static double FWMath::mod double  dividend,
double  divisor
[inline, static]
 

Returns the rest of a whole-numbered division.

00059                                                      {
00060       double i;
00061       return modf(dividend/divisor, &i)*divisor;
00062   }

static int FWMath::round double  d  )  [inline, static]
 

Returns:
integer that corresponds to rounded double parameter
00098 { return (int)(ceil(d-0.5)); }

static int FWMath::sign double  i  )  [inline, static]
 

Returns:
1 if parameter greater or equal zero, -1 otherwise
00093 { return (i>=0)? 1 : -1; };

static int FWMath::stepfunction double  i  )  [inline, static]
 

Returns:
0 if i is close to 0, 1 if i is positive greater epsilon, -1 if it is negative smaller epsilon.
00087 { return (i>EPSILON) ? 1 : close(i,0) ? 0 :-1; };


The documentation for this class was generated from the following file:
Generated on Thu Oct 19 18:22:22 2006 for INET Framework for OMNeT++/OMNEST by  doxygen 1.4.0