Thanks for your corrections, I've uploaded a new patchset, which fixes the rounding of negative numbers.
https://chromiumcodereview.appspot.com/10870049/diff/1/src/mips/simulator-mips.cc File src/mips/simulator-mips.cc (right): https://chromiumcodereview.appspot.com/10870049/diff/1/src/mips/simulator-mips.cc#newcode2073 src/mips/simulator-mips.cc:2073: double rounded = fs > 0 ? floor(fs + 0.5) : ceil(fs - 0.5); On 2012/08/24 07:21:07, ulan wrote:
Why not just do floor(fs + 0.5) for both positive and negative values?
Done. https://chromiumcodereview.appspot.com/10870049/diff/1/src/mips/simulator-mips.cc#newcode2075 src/mips/simulator-mips.cc:2075: if ((result & 1) != 0 && result - fs == 0.5) { On 2012/08/24 07:21:07, ulan wrote:
This doesn't handle the case when fs is negative, e.g. fs == -4.5,
result == -5,
result-fs == -0.5.
Using floor(fs + 0.5) above for negative numbers too, this expression becomes correct: e.g. fs = -4.5, result = -4 -> result-fs = 0.5 or fs = 4.5, result = 5 -> result-fs = 0.5 It'll be true for all other cases, because we always round half up in the first step. https://chromiumcodereview.appspot.com/10870049/ -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
