Fix abs() family functions type usage mismatch.
Change-Id: I85ed2931d681aa1ad024678b4209a524abc2cc61
Signed-off-by: Alexey Shvetsov <alexxy@omrb.pnpi.spb.ru>
return res;
}
+/* can be replaced by llabs in 5.0 (allows C99)*/
+static gmx_off_t
+gmx_llabs(gmx_off_t x)
+{
+ return x>0?x:-x;
+}
int
xdr_xtc_seek_frame(int frame, FILE *fp, XDR *xdrs, int natoms)
{
return -1;
}
- if (fr != frame && abs(low-high) > header_size)
+ if (fr != frame && gmx_llabs(low-high) > header_size)
{
if (fr < frame)
{
the current time and the target time is bigger than dt and above all the distance between high
and low is bigger than 1 frame, then do another step of binary search. Otherwise stop and check
if we reached the solution */
- if ((((t < time && dt_sign >= 0) || (t > time && dt_sign == -1)) || ((t
- - time) >= dt && dt_sign >= 0)
- || ((time - t) >= -dt && dt_sign < 0)) && (abs(low - high)
- > header_size))
+ if ((((t < time && dt_sign >= 0) || (t > time && dt_sign == -1)) ||
+ ((t - time) >= dt && dt_sign >= 0) || ((time - t) >= -dt && dt_sign < 0)) &&
+ (gmx_llabs(low - high) > header_size))
{
if (dt >= 0 && dt_sign != -1)
{
}
else
{
- if (abs(low - high) <= header_size)
+ if (gmx_llabs(low - high) <= header_size)
{
break;
}
bBad = FALSE;
/* An acf of binary data must be one at t=0. */
- if (abs(ct[0]-1.0) > 1e-6)
+ if (fabs(ct[0]-1.0) > 1e-6)
{
ct[0] = 1.0;
- fprintf(stderr, "|ct[0]-1.0| = %1.6d. Setting ct[0] to 1.0.\n", abs(ct[0]-1.0));
+ fprintf(stderr, "|ct[0]-1.0| = %1.6f. Setting ct[0] to 1.0.\n", fabs(ct[0]-1.0));
}
for (i = 0; i < len; i++)
{
for (i = 0; i < n; i++)
{
- if (bSplit && i > 0 && abs(x[i]) < 1e-5)
+ if (bSplit && i > 0 && fabs(x[i]) < 1e-5)
{
if (output_env_get_print_xvgr_codes(oenv))
{
oenv);
for (i = 0; i < nframes; i++)
{
- if (bSplit && i > 0 && abs(inprod[noutvec][i]) < 1e-5)
+ if (bSplit && i > 0 && fabs(inprod[noutvec][i]) < 1e-5)
{
fprintf(xvgrout, "&\n");
}
j = 0;
for (i = 0; i < atoms.nr; i++)
{
- if (j > 0 && bSplit && abs(inprod[noutvec][i]) < 1e-5)
+ if (j > 0 && bSplit && fabs(inprod[noutvec][i]) < 1e-5)
{
fprintf(out, "TER\n");
j = 0;
}
}
- if (abs(qall) > 0.01)
+ if (fabs(qall) > 0.01)
{
printf("\n\nSystem not neutral (q=%f) will not calculate translational part of the dipole moment.\n", qall);
bNEU = FALSE;
ind_mini = ind_min[0];
ind_minj = ind_min[1];
}
- if (bSplit && !bFirst && abs(t/output_env_get_time_factor(oenv)) < 1e-5)
+ if (bSplit && !bFirst && fabs(t/output_env_get_time_factor(oenv)) < 1e-5)
{
fprintf(out, "&\n");
}
bFirst = TRUE;
do
{
- if (bSplit && !bFirst && abs(t/output_env_get_time_factor(oenv)) < 1e-5)
+ if (bSplit && !bFirst && fabs(t/output_env_get_time_factor(oenv)) < 1e-5)
{
fprintf(dist, "&\n");
if (num)
for (i = 0; (i < teller); i++)
{
if (bSplit && i > 0 &&
- abs(time[bPrev ? freq*i : i]/output_env_get_time_factor(oenv)) < 1e-5)
+ fabs(time[bPrev ? freq*i : i]/output_env_get_time_factor(oenv)) < 1e-5)
{
fprintf(fp, "&\n");
}
}
for (i = 0; (i < teller); i++)
{
- if (bSplit && i > 0 && abs(time[i]) < 1e-5)
+ if (bSplit && i > 0 && fabs(time[i]) < 1e-5)
{
fprintf(fp, "&\n");
}
xx = xx00+(x+0.7)*psr->xboxsize;
/* draw lines whenever tick label almost zero (e.g. next trajectory) */
if (x != 0 && x < mat[i].nx-1 &&
- abs(mat[i].axis_x[x]) <
- 0.1*abs(mat[i].axis_x[x+1]-mat[i].axis_x[x]) )
+ fabs(mat[i].axis_x[x]) <
+ 0.1*fabs(mat[i].axis_x[x+1]-mat[i].axis_x[x]) )
{
ps_line (out, xx, yy00, xx, yy00+dy+2);
}
yy = yy00+(y+0.7)*psr->yboxsize;
/* draw lines whenever tick label almost zero (e.g. next trajectory) */
if (y != 0 && y < mat[i].ny-1 &&
- abs(mat[i].axis_y[y]) <
- 0.1*abs(mat[i].axis_y[y+1]-mat[i].axis_y[y]) )
+ fabs(mat[i].axis_y[y]) <
+ 0.1*fabs(mat[i].axis_y[y+1]-mat[i].axis_y[y]) )
{
ps_line (out, xx00, yy, xx00+w+2, yy);
}
}
for (x = 0; x < mats[i].nx-1; x++)
{
- if (abs(mats[i].axis_x[x+1]) < 1e-5)
+ if (fabs(mats[i].axis_x[x+1]) < 1e-5)
{
for (y = 0; y < mats[i].ny; y++)
{
}
for (y = 0; y < mats[i].ny-1; y++)
{
- if (abs(mats[i].axis_y[y+1]) < 1e-5)
+ if (fabs(mats[i].axis_y[y+1]) < 1e-5)
{
for (x = 0; x < mats[i].nx; x++)
{