1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2006, 2011 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 #ifndef LIBPSPP_FLOAT_FORMAT_H
18 #define LIBPSPP_FLOAT_FORMAT_H 1
22 #include "libpspp/compiler.h"
24 /* A floating-point format. */
27 /* IEEE 754 formats. */
28 FLOAT_IEEE_SINGLE_LE, /* 32 bit, little endian. */
29 FLOAT_IEEE_SINGLE_BE, /* 32 bit, big endian. */
30 FLOAT_IEEE_DOUBLE_LE, /* 64 bit, little endian. */
31 FLOAT_IEEE_DOUBLE_BE, /* 64 bit, big endian. */
34 FLOAT_VAX_F, /* 32 bit VAX F format. */
35 FLOAT_VAX_D, /* 64 bit VAX D format. */
36 FLOAT_VAX_G, /* 64 bit VAX G format. */
38 /* IBM z architecture (390) hexadecimal formats. */
39 FLOAT_Z_SHORT, /* 32 bit format. */
40 FLOAT_Z_LONG, /* 64 bit format. */
42 /* Formats useful for testing. */
43 FLOAT_FP, /* Neutral intermediate format. */
44 FLOAT_HEX, /* C99 hexadecimal floating constant. */
46 #ifdef WORDS_BIGENDIAN
47 FLOAT_NATIVE_FLOAT = FLOAT_IEEE_SINGLE_BE,
48 FLOAT_NATIVE_DOUBLE = FLOAT_IEEE_DOUBLE_BE,
49 FLOAT_NATIVE_32_BIT = FLOAT_IEEE_SINGLE_BE,
50 FLOAT_NATIVE_64_BIT = FLOAT_IEEE_DOUBLE_BE
52 FLOAT_NATIVE_FLOAT = FLOAT_IEEE_SINGLE_LE,
53 FLOAT_NATIVE_DOUBLE = FLOAT_IEEE_DOUBLE_LE,
54 FLOAT_NATIVE_32_BIT = FLOAT_IEEE_SINGLE_LE,
55 FLOAT_NATIVE_64_BIT = FLOAT_IEEE_DOUBLE_LE
59 void float_convert (enum float_format, const void *,
60 enum float_format, void *);
62 double float_get_double (enum float_format, const void *);
64 size_t float_get_size (enum float_format) PURE_FUNCTION;
66 int float_identify (double expected_value, const void *, size_t,
67 enum float_format *best_guess);
69 double float_get_lowest (void);
71 #endif /* float-format.h */