platform_ldbl128.c revision 1.6 1 /* $NetBSD: platform_ldbl128.c,v 1.6 2023/07/05 11:42:14 rillig Exp $ */
2 # 3 "platform_ldbl128.c"
3
4 /*
5 * Test features that only apply to platforms that have 128-bit long double.
6 */
7
8 /* lint1-extra-flags: -c -h -a -p -b -r -z -X 351 */
9 /* lint1-only-if: ldbl128 */
10
11 /* CONSTCOND */
12 typedef int bits_per_byte[((unsigned char)-1) == 255 ? 1 : -1];
13 typedef int bytes_per_long_double[sizeof(long double) == 16 ? 1 : -1];
14
15 /*
16 * Platforms with 128-bit 'long double' typically use IEEE 754-2008, which has
17 * 1 bit sign + 15 bit exponent + 112 bit normalized mantissa. This means the
18 * maximum representable value is 1.1111111(bin) * 2^16383, which is about
19 * 1.189e4932. This is in the same range as for 96-bit 'long double', as the
20 * exponent range is the same.
21 */
22 /* expect+1: warning: floating-point constant out of range [248] */
23 double larger_than_ldbl = 1e4933;
24 /* expect+1: warning: floating-point constant out of range [248] */
25 long double larger_than_ldbl_l = 1e4933L;
26 /* expect+1: warning: floating-point constant out of range [248] */
27 double larger_than_dbl = 1e4932;
28 /* Fits in 'long double' but not in 'double'. */
29 long double larger_than_dbl_l = 1e4932L;
30