changed reading hint
[gromacs/adressmacs.git] / src / gmxlib / maths.c
blobb9d2bb85afbdf0e86f681a63885976c69f18a472
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 2.0
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * Please refer to:
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
23 * or e-mail to:
24 * gromacs@chem.rug.nl
26 * And Hey:
27 * Green Red Orange Magenta Azure Cyan Skyblue
29 static char *SRCID_maths_c = "$Id$";
31 #include <math.h>
32 #include "maths.h"
34 int gmx_nint(real a)
36 const real half = .5;
37 int result;
39 result = (a < 0.) ? ((int)(a - half)) : ((int)(a + half));
40 return result;
43 real sign(real x,real y)
45 if (y < 0)
46 return -fabs(x);
47 else
48 return +fabs(x);