4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
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
27 * Good ROcking Metal Altar for Chronical Sinners
33 static char *SRCID_lutab_h
= "$Id$";
36 #ident "@(#) lutab.h 1.7 2/2/97"
37 #endif /* HAVE_IDENT */
39 Fast sqrt(x) routine (actually 1.0/sqrt(x)) By A. Sijbers (c) 1992
41 Based on Newton Rhapson iteration, initial value from lookup table
43 Floating point representation:
46 3322 2222 2222 1111 1111 1000 0000 0000
47 bitnr 1098 7654 3210 9876 5432 1098 7654 3210
48 |||| |||| |+-- ---- ---- ---- ---- ---+ fraction
56 IEEE : value = (-1) (2 ) (1.F) <------ must be float representation
59 DEC : value = (-1) (2 ) (0.1F)
64 #define EXP_LSB 0x00800000
65 #define EXP_SEED_SIZE 256
66 #define EXP_MASK 0x7f800000
68 #define MAX_FRACT 0x007fffff
69 #define FRACT_MASK 0x007fffff
70 #define FRACT_SIZE 11 /* significant part of fraction */
71 #define FRACT_SHIFT (EXP_SHIFT-FRACT_SIZE)
72 #define FRACT_SEED_SIZE (1<<(FRACT_SIZE+1)) /* one bit for even/odd */
73 #define FRACT_FIRST (0x3f800000>>FRACT_SHIFT)
74 #define NOT_INITIALISED ~0
75 #define EXP_ADDR(val) (((val)&EXP_MASK)>>EXP_SHIFT)
76 #define FRACT_ADDR(val) (((val)&(FRACT_MASK|EXP_LSB))>>FRACT_SHIFT)
78 typedef unsigned int word
;
88 word exp_seed
[EXP_SEED_SIZE
];
89 word fract_seed
[FRACT_SEED_SIZE
];
92 /* Global variable, must be initiated by a call to init_lookup_table */
93 extern t_lutab lookup_table
;
95 extern void init_lookup_table(FILE *log
);