[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Commit df1b639baf "Fixes round problem" appears wrong to me.
From: |
David Kastrup |
Subject: |
Commit df1b639baf "Fixes round problem" appears wrong to me. |
Date: |
Tue, 01 Mar 2011 23:51:31 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
The diff says something like
{
Real yshift = config->y[LEFT] - 0.5 * staff_space;
- if (abs (round(yshift) - yshift) < 0.01 * staff_space)
+ if (abs ((int)(yshift + 0.5) - yshift) < 0.01 * staff_space)
config->add (parameters.HORIZONTAL_INTER_QUANT_PENALTY, "H");
}
Now here is the problem: casting to int rounds towards zero. For
negative yshift, the equation becomes mostly nonsensical I think.
For example, if yshift == -1, we get abs((int)-0.5 - -1) < ...
which is abs(1) < ....
I doubt that this is the intent.
Instead of casting to int, one would probably need to use the floor
function.
--
David Kastrup
- Commit df1b639baf "Fixes round problem" appears wrong to me.,
David Kastrup <=