Most routing protocols do not compare floating-point numbers properly.
For example, see the following code used by the Compare & Replicate routing protocol.
if(myUtil < Utils[i])
{
runner++;
BetterFw[runner]=Requests[i];
}
The above condition returns true for many "0 < 0" comparisons, increasing the number of replicas in the network significantly.
We can solve this problem by replacing it with the following code:
if(Utils[i] - myUtil > DBL_EPSILON)
{
runner++;
BetterFw[runner]=Requests[i];
}
Most routing protocols do not compare floating-point numbers properly.
For example, see the following code used by the Compare & Replicate routing protocol.
The above condition returns true for many "0 < 0" comparisons, increasing the number of replicas in the network significantly.
We can solve this problem by replacing it with the following code: