Skip to content

Commit

Permalink
prefer rounding up when trading instructions for time
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Suda committed Dec 5, 2023
1 parent fb84b39 commit c6b72c3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions CASC/PortfolioMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,9 @@ unsigned PortfolioMode::getSliceTime(const vstring &sliceCode)
vstring sliceInstrStr = sliceCode.substr(bidx,eidx-bidx);
unsigned sliceInstr;
ALWAYS(Int::stringToUnsignedInt(sliceInstrStr,sliceInstr));

// sliceTime is in deci second, we assume a roughly 2GHz CPU here
sliceTime = sliceInstr / 200;
if (sliceTime == 0) { sliceTime = 1; }
sliceTime = 1 + sliceInstr / 200; // rather round up than down (and never return 0 here)
}

return _slowness * sliceTime;
Expand Down

0 comments on commit c6b72c3

Please sign in to comment.