1 /* PSPP - computes sample statistics.
2 Copyright (C) 2006 Free Software Foundation, Inc.
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.
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.
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
19 #ifndef LIBPSPP_FLOAT_FORMAT_H
20 #define LIBPSPP_FLOAT_FORMAT_H 1
24 #include <libpspp/compiler.h>
26 /* A floating-point format. */
29 /* IEEE 754 formats. */
30 FLOAT_IEEE_SINGLE_LE, /* 32 bit, little endian. */
31 FLOAT_IEEE_SINGLE_BE, /* 32 bit, big endian. */
32 FLOAT_IEEE_DOUBLE_LE, /* 64 bit, little endian. */
33 FLOAT_IEEE_DOUBLE_BE, /* 64 bit, big endian. */
36 FLOAT_VAX_F, /* 32 bit VAX F format. */
37 FLOAT_VAX_D, /* 64 bit VAX D format. */
38 FLOAT_VAX_G, /* 64 bit VAX G format. */
40 /* IBM z architecture (390) hexadecimal formats. */
41 FLOAT_Z_SHORT, /* 32 bit format. */
42 FLOAT_Z_LONG, /* 64 bit format. */
44 /* Formats useful for testing. */
45 FLOAT_FP, /* Neutral intermediate format. */
46 FLOAT_HEX, /* C99 hexadecimal floating constant. */
49 #ifdef WORDS_BIGENDIAN
50 FLOAT_NATIVE_FLOAT = FLOAT_IEEE_SINGLE_BE,
51 FLOAT_NATIVE_DOUBLE = FLOAT_IEEE_DOUBLE_BE,
52 FLOAT_NATIVE_32_BIT = FLOAT_IEEE_SINGLE_BE,
53 FLOAT_NATIVE_64_BIT = FLOAT_IEEE_DOUBLE_BE
55 FLOAT_NATIVE_FLOAT = FLOAT_IEEE_SINGLE_LE,
56 FLOAT_NATIVE_DOUBLE = FLOAT_IEEE_DOUBLE_LE,
57 FLOAT_NATIVE_32_BIT = FLOAT_IEEE_SINGLE_LE,
58 FLOAT_NATIVE_64_BIT = FLOAT_IEEE_DOUBLE_LE
61 #error Only IEEE-754 floating point currently supported for PSPP hosts.
65 void float_convert (enum float_format, const void *,
66 enum float_format, void *);
68 double float_get_double (enum float_format, const void *);
70 size_t float_get_size (enum float_format) PURE_FUNCTION;
72 int float_identify (double expected_value, const void *, size_t,
73 enum float_format *best_guess);
75 #endif /* float-format.h */