1 // Copyright (C) 2009-2013 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library 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 along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-require-effective-target dfp }
20 // ISO/IEC TR 24733 3.2.6 Conversion to generic floating-point type.
22 #include <decimal/decimal>
23 #include <testsuite_hooks.h>
25 using namespace std::decimal
;
28 conversion_to_generic_float_32 ()
30 bool test
__attribute__((unused
)) = true;
36 f
= decimal32_to_float (d32
);
38 d
= decimal32_to_double (d32
);
40 ld
= decimal32_to_long_double (d32
);
44 f
= decimal_to_float (d32
);
46 d
= decimal_to_double (d32
);
48 ld
= decimal_to_long_double (d32
);
53 conversion_to_generic_float_64 ()
55 bool test
__attribute__((unused
)) = true;
61 f
= decimal64_to_float (d64
);
63 d
= decimal64_to_double (d64
);
65 ld
= decimal64_to_long_double (d64
);
69 f
= decimal_to_float (d64
);
71 d
= decimal_to_double (d64
);
73 ld
= decimal_to_long_double (d64
);
78 conversion_to_generic_float_128 ()
80 bool test
__attribute__((unused
)) = true;
86 f
= decimal128_to_float (d128
);
88 d
= decimal128_to_double (d128
);
90 ld
= decimal128_to_long_double (d128
);
94 f
= decimal_to_float (d128
);
96 d
= decimal_to_double (d128
);
98 ld
= decimal_to_long_double (d128
);
105 conversion_to_generic_float_32 ();
106 conversion_to_generic_float_64 ();
107 conversion_to_generic_float_128 ();