mirror of https://github.com/GNOME/gimp.git
Bug 788461 - Selection with a Fixed size is created with an ...
... off-by one size in special cases The last commit wasn't drastic enough. We changed SIGNED_ROUND() to use RINT(), which, in turn, may use rint(). However, rint() effectively breaks ties to even, so that we get stuff like 'rint (1.5) - rint (0.5) == 2.0 - 0.0 == 2.0'. This can't be good--it's entirely possible that we're bitten by this in other cases without noticing. Avoid rint() entirely in RINT(), and always use 'floor (x) + 0.5' instead, which always breaks ties up. Hopefully, this doesn't break anything else...
This commit is contained in:
parent
e8b37a7a25
commit
80a526861f
|
@ -64,7 +64,13 @@ G_BEGIN_DECLS
|
|||
* This macro rounds its argument @x to an integer value in floating
|
||||
* point format. Use RINT() instead of rint().
|
||||
**/
|
||||
#ifdef HAVE_RINT
|
||||
#if defined (HAVE_RINT) && 0
|
||||
/* note: rint() depends on the current floating-point rounding mode. when the
|
||||
* rounding mode is FE_TONEAREST, it, in parctice, breaks ties to even. this
|
||||
* is different from 'floor (x + 0.5)', which breaks ties up. in other words
|
||||
* 'rint (2.5) == 2.0', while 'floor (2.5 + 0.5) == 3.0'. this is asking for
|
||||
* trouble, so let's just use the latter.
|
||||
*/
|
||||
#define RINT(x) rint(x)
|
||||
#else
|
||||
#define RINT(x) floor ((x) + 0.5)
|
||||
|
|
Loading…
Reference in New Issue