formula-with-inverse.h File Reference

#include "formula.h"

Include dependency graph for formula-with-inverse.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

double b_to_p (double b, double rtt, double tzero, int psize, int bval)


Function Documentation

double b_to_p double  b,
double  rtt,
double  tzero,
int  psize,
int  bval
 

Definition at line 3 of file formula-with-inverse.h.

References p_to_b().

Referenced by TfrcSinkAgent::est_loss_RBPH().

00004 {
00005     double p, pi, bres;
00006     int ctr=0;
00007     p=0.5;pi=0.25;
00008     while(1) {
00009         bres=p_to_b(p,rtt,tzero,psize, bval);
00010         /*
00011          * if we're within 5% of the correct value from below, this is OK
00012          * for this purpose.
00013          */
00014         if ((bres>0.95*b)&&(bres<1.05*b)) 
00015             return p;
00016         if (bres>b) {
00017             p+=pi;
00018         } else {
00019             p-=pi;
00020         }
00021         pi/=2.0;
00022         ctr++;
00023         if (ctr>30) {
00024             return p;
00025         }
00026     }
00027 }

Here is the call graph for this function:


Generated on Tue Mar 6 16:52:51 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6