platform_ldbl96.c revision 1.7
1/*	$NetBSD: platform_ldbl96.c,v 1.7 2025/04/10 20:37:49 rillig Exp $	*/
2# 3 "platform_ldbl96.c"
3
4/*
5 * Test features that only apply to platforms that have 96-bit long double.
6 */
7
8/* lint1-extra-flags: -c -h -a -p -b -r -z -X 351 */
9/* lint1-only-if: ldbl96 */
10
11typedef int bits_per_byte[((unsigned char)-1) == 255 ? 1 : -1];
12typedef int bytes_per_long_double[sizeof(long double) == 12 ? 1 : -1];
13
14/*
15 * Both i386 and m68k use the same floating point format for 'long double',
16 * which has 1 bit sign + 15 bit exponent + 64 bit unnormalized mantissa.
17 * This means the maximum representable value is 1.1111111(bin) * 2^16383,
18 * which is about 1.189e4932.
19 */
20/* expect+1: warning: floating-point constant out of range [248] */
21double larger_than_ldbl = 1e4933;
22/* expect+1: warning: floating-point constant out of range [248] */
23long double larger_than_ldbl_l = 1e4933L;
24/* expect+1: warning: floating-point constant out of range [248] */
25double larger_than_dbl = 1e4932;
26/* Fits in 'long double' but not in 'double'. */
27long double larger_than_dbl_l = 1e4932L;
28