mirror of https://github.com/YosysHQ/abc.git
Fixing float overflow during edge-flow computation in 'if' mapper (change to avoid dependence on the order of additions).
This commit is contained in:
parent
2f88284d7b
commit
1f016988b2
|
|
@ -934,7 +934,11 @@ float If_CutAreaFlow( If_Man_t * p, If_Cut_t * pCut )
|
|||
if ( Flow >= (float)1e32 || AddOn >= (float)1e32 )
|
||||
Flow = (float)1e32;
|
||||
else
|
||||
{
|
||||
Flow += AddOn;
|
||||
if ( Flow > (float)1e32 )
|
||||
Flow = (float)1e32;
|
||||
}
|
||||
}
|
||||
return Flow;
|
||||
}
|
||||
|
|
@ -968,7 +972,11 @@ float If_CutEdgeFlow( If_Man_t * p, If_Cut_t * pCut )
|
|||
if ( Flow >= (float)1e32 || AddOn >= (float)1e32 )
|
||||
Flow = (float)1e32;
|
||||
else
|
||||
{
|
||||
Flow += AddOn;
|
||||
if ( Flow > (float)1e32 )
|
||||
Flow = (float)1e32;
|
||||
}
|
||||
}
|
||||
return Flow;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue