1 /* PSPP - computes sample statistics.
2 Copyright (C) 2006 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 #ifndef LIBPSPP_FLOAT_FORMAT_H
21 #define LIBPSPP_FLOAT_FORMAT_H 1
25 #include <libpspp/compiler.h>
27 /* A floating-point format. */
30 /* IEEE 754 formats. */
31 FLOAT_IEEE_SINGLE_LE, /* 32 bit, little endian. */
32 FLOAT_IEEE_SINGLE_BE, /* 32 bit, big endian. */
33 FLOAT_IEEE_DOUBLE_LE, /* 64 bit, little endian. */
34 FLOAT_IEEE_DOUBLE_BE, /* 64 bit, big endian. */
37 FLOAT_VAX_F, /* 32 bit VAX F format. */
38 FLOAT_VAX_D, /* 64 bit VAX D format. */
39 FLOAT_VAX_G, /* 64 bit VAX G format. */
41 /* IBM z architecture (390) hexadecimal formats. */
42 FLOAT_Z_SHORT, /* 32 bit format. */
43 FLOAT_Z_LONG, /* 64 bit format. */
45 /* Formats useful for testing. */
46 FLOAT_FP, /* Neutral intermediate format. */
47 FLOAT_HEX, /* C99 hexadecimal floating constant. */
50 #ifdef WORDS_BIGENDIAN
51 FLOAT_NATIVE_FLOAT = FLOAT_IEEE_SINGLE_BE,
52 FLOAT_NATIVE_DOUBLE = FLOAT_IEEE_DOUBLE_BE
53 FLOAT_NATIVE_32_BIT = FLOAT_IEEE_SINGLE_BE,
54 FLOAT_NATIVE_64_BIT = FLOAT_IEEE_DOUBLE_BE
56 FLOAT_NATIVE_FLOAT = FLOAT_IEEE_SINGLE_LE,
57 FLOAT_NATIVE_DOUBLE = FLOAT_IEEE_DOUBLE_LE,
58 FLOAT_NATIVE_32_BIT = FLOAT_IEEE_SINGLE_LE,
59 FLOAT_NATIVE_64_BIT = FLOAT_IEEE_DOUBLE_LE
62 #error Only IEEE-754 floating point currently supported for PSPP hosts.
66 void float_convert (enum float_format, const void *,
67 enum float_format, void *);
69 double float_get_double (enum float_format, const void *);
71 size_t float_get_size (enum float_format) PURE_FUNCTION;
73 int float_identify (double expected_value, const void *, size_t,
74 enum float_format *best_guess);
76 #endif /* float-format.h */