Remove "Written by Ben Pfaff <blp@gnu.org>" lines everywhere.
[pspp-builds.git] / src / data / value.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or
5    modify it under the terms of the GNU General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17    02110-1301, USA. */
18
19 #if !value_h
20 #define value_h 1
21
22 #include <float.h>
23 #include <libpspp/misc.h>
24 #include "minmax.h"
25
26 /* Values. */
27
28 /* "Short" strings, which are generally those no more than 8
29    characters wide, can participate in more operations than
30    longer strings. */
31 #define MAX_SHORT_STRING (MAX (ROUND_UP (SIZEOF_DOUBLE, 2), 8))
32 #define MIN_LONG_STRING (MAX_SHORT_STRING + 1)
33 #define MAX_STRING 32767
34
35 /* Special values. */
36 #define SYSMIS (-DBL_MAX)
37 #define LOWEST second_lowest_value
38 #define HIGHEST DBL_MAX
39
40 /* A numeric or short string value.
41    Multiple consecutive values represent a long string. */
42 union value
43   {
44     double f;
45     char s[MAX_SHORT_STRING];
46   };
47
48 union value *value_dup (const union value *, int width);
49 int compare_values (const union value *, const union value *, int width);
50 unsigned hash_value (const union value  *, int width);
51
52 #endif /* !value.h */