Commit 1f016988 by Alan Mishchenko

Fixing float overflow during edge-flow computation in 'if' mapper (change to…

Fixing float overflow during edge-flow computation in 'if' mapper (change to avoid dependence on the order of additions).
parent 2f88284d
...@@ -934,7 +934,11 @@ float If_CutAreaFlow( If_Man_t * p, If_Cut_t * pCut ) ...@@ -934,7 +934,11 @@ float If_CutAreaFlow( If_Man_t * p, If_Cut_t * pCut )
if ( Flow >= (float)1e32 || AddOn >= (float)1e32 ) if ( Flow >= (float)1e32 || AddOn >= (float)1e32 )
Flow = (float)1e32; Flow = (float)1e32;
else else
{
Flow += AddOn; Flow += AddOn;
if ( Flow > (float)1e32 )
Flow = (float)1e32;
}
} }
return Flow; return Flow;
} }
...@@ -968,7 +972,11 @@ float If_CutEdgeFlow( If_Man_t * p, If_Cut_t * pCut ) ...@@ -968,7 +972,11 @@ float If_CutEdgeFlow( If_Man_t * p, If_Cut_t * pCut )
if ( Flow >= (float)1e32 || AddOn >= (float)1e32 ) if ( Flow >= (float)1e32 || AddOn >= (float)1e32 )
Flow = (float)1e32; Flow = (float)1e32;
else else
{
Flow += AddOn; Flow += AddOn;
if ( Flow > (float)1e32 )
Flow = (float)1e32;
}
} }
return Flow; return Flow;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment