1 /* Floating point definitions for GDB.
3 Copyright (C) 1986-2017 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26 /* Use `long double' if the host compiler supports it. (Note that this is not
27 necessarily any longer than `double'. On SunOS/gcc, it's the same as
28 double.) This is necessary because GDB internally converts all floating
29 point values to the widest type supported by the host.
31 There are problems however, when the target `long double' is longer than the
32 host's `long double'. In general, we'll probably reduce the precision of
33 any such values and print a warning. */
35 #if (defined HAVE_LONG_DOUBLE && defined PRINTF_HAS_LONG_DOUBLE \
36 && defined SCANF_HAS_LONG_DOUBLE)
37 typedef long double DOUBLEST
;
38 # define DOUBLEST_PRINT_FORMAT "Lg"
39 # define DOUBLEST_SCAN_FORMAT "Lg"
41 typedef double DOUBLEST
;
42 # define DOUBLEST_PRINT_FORMAT "g"
43 # define DOUBLEST_SCAN_FORMAT "lg"
44 /* If we can't scan or print long double, we don't want to use it
46 # undef HAVE_LONG_DOUBLE
47 # undef PRINTF_HAS_LONG_DOUBLE
48 # undef SCANF_HAS_LONG_DOUBLE
51 /* Different kinds of floatformat numbers recognized by
52 floatformat_classify. To avoid portability issues, we use local
53 values instead of the C99 macros (FP_NAN et cetera). */
62 extern void floatformat_to_doublest (const struct floatformat
*,
63 const void *in
, DOUBLEST
*out
);
64 extern void floatformat_from_doublest (const struct floatformat
*,
65 const DOUBLEST
*in
, void *out
);
67 extern int floatformat_is_negative (const struct floatformat
*,
69 extern enum float_kind
floatformat_classify (const struct floatformat
*,
71 extern const char *floatformat_mantissa (const struct floatformat
*,
74 /* Return the floatformat's total size in host bytes. */
76 extern size_t floatformat_totalsize_bytes (const struct floatformat
*fmt
);
78 extern DOUBLEST
extract_typed_floating (const void *addr
,
79 const struct type
*type
);
80 extern void store_typed_floating (void *addr
, const struct type
*type
,
82 extern void convert_typed_floating (const void *from
,
83 const struct type
*from_type
,
84 void *to
, const struct type
*to_type
);
This page took 0.030199 seconds and 4 git commands to generate.