[CoinUtils-tickets] [COIN-OR Common Utilities] #12: incorrect
rounding in CoinLpIO
COIN-OR Common Utilities
coin-trac at coin-or.org
Thu Jan 11 10:01:48 EST 2007
#12: incorrect rounding in CoinLpIO
------------------------+---------------------------------------------------
Reporter: fmargot | Owner: somebody
Type: defect | Status: new
Priority: major | Milestone:
Component: component1 | Version:
Keywords: |
------------------------+---------------------------------------------------
The following code in CoinLpIO::out_coeff()
if(frac < lp_eps) {
fprintf(fp, " %.0f", v);
}
else {
if(frac > 1 - lp_eps) {
fprintf(fp, " %.0f", v+1);
}
is incorrect for negative numbers close to integer values.
This should be replaced by:
if(frac < lp_eps) {
fprintf(fp, " %.0f", floor(v));
}
else {
if(frac > 1 - lp_eps) {
fprintf(fp, " %.0f", floor(v+0.5));
}
--
Ticket URL: <https://projects.coin-or.org/CoinUtils/ticket/12>
COIN-OR Common Utilities <http://projects.coin-or.org/CoinUtils>
Common data structures and linear algebra functions for COIN-OR projects
More information about the CoinUtils-tickets
mailing list