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