plug-ins: fix more abs().
I am comparing absolute value of 2 double computation results. Might as
well just use fabs() instead of truncating both values to int.
Fixes the following:
> warning: using integer absolute value function ‘abs’ when argument is
> of floating point type ‘double’ [-Wabsolute-value]
(cherry picked from commit f6dd30f3a8
)
This commit is contained in:
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
@ -309,8 +310,8 @@ find_grid_pos (GdkPoint *p,
|
|||||||
m_hi_n_lo = m_lo_n_lo + 1;
|
m_hi_n_lo = m_lo_n_lo + 1;
|
||||||
|
|
||||||
/* figure out which is the better candidate */
|
/* figure out which is the better candidate */
|
||||||
if (abs ((m_lo_n_lo * r + (0.5 * r * (n_lo % 2))) - y) <
|
if (fabs ((m_lo_n_lo * r + (0.5 * r * (n_lo % 2))) - y) <
|
||||||
abs ((m_hi_n_lo * r + (0.5 * r * (n_lo % 2))) - y))
|
fabs ((m_hi_n_lo * r + (0.5 * r * (n_lo % 2))) - y))
|
||||||
{
|
{
|
||||||
m_n_lo = m_lo_n_lo;
|
m_n_lo = m_lo_n_lo;
|
||||||
}
|
}
|
||||||
@ -324,8 +325,8 @@ find_grid_pos (GdkPoint *p,
|
|||||||
m_hi_n_hi = m_lo_n_hi + 1;
|
m_hi_n_hi = m_lo_n_hi + 1;
|
||||||
|
|
||||||
/* figure out which is the better candidate */
|
/* figure out which is the better candidate */
|
||||||
if (abs((m_lo_n_hi * r + (0.5 * r * (n_hi % 2))) - y) <
|
if (fabs((m_lo_n_hi * r + (0.5 * r * (n_hi % 2))) - y) <
|
||||||
abs((m_hi_n_hi * r + (0.5 * r * (n_hi % 2))) - y))
|
fabs((m_hi_n_hi * r + (0.5 * r * (n_hi % 2))) - y))
|
||||||
{
|
{
|
||||||
m_n_hi = m_lo_n_hi;
|
m_n_hi = m_lo_n_hi;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user