float.h revision 1.8 1 1.8 rillig /* $NetBSD: float.h,v 1.8 2024/06/15 11:44:09 rillig Exp $ */
2 1.1 fvdl
3 1.1 fvdl #ifndef _X86_FLOAT_H_
4 1.1 fvdl #define _X86_FLOAT_H_
5 1.1 fvdl
6 1.6 joerg #include <sys/featuretest.h>
7 1.6 joerg
8 1.7 dholland /*
9 1.7 dholland * LDBL_MIN is twice the m68k LDBL_MIN, even though both are 12-byte
10 1.7 dholland * floats with the same base properties and both allegedly
11 1.7 dholland * IEEE-compliant, because both these representations materialize the
12 1.7 dholland * top (integer-part) bit of the mantissa. But on m68k if the exponent
13 1.7 dholland * is 0 and the integer bit is set, it's a regular number, whereas on
14 1.7 dholland * x86 it's called a pseudo-denormal and apparently treated as a
15 1.7 dholland * denormal, so it doesn't count as a valid value for LDBL_MIN.
16 1.7 dholland *
17 1.7 dholland * x86 citation: Intel 64 and IA-32 Architectures Software Developer's
18 1.7 dholland * Manual, vol. 1 (Order Number: 253665-077US, April 2022), Sec. 8.2.2
19 1.7 dholland * `Unsupported Double Extended-Precision Floating-Point Encodings
20 1.7 dholland * and Pseudo-Denormals', p. 8-14.
21 1.7 dholland *
22 1.7 dholland * m86k citation: MC68881/MC68882 Floating-Point Coprocessor User's
23 1.7 dholland * Manual, Second Edition (Prentice-Hall, 1989, apparently issued by
24 1.7 dholland * Freescale), Section 3.2 `Binary Real Data formats', pg. 3-3 bottom
25 1.7 dholland * in particular and pp. 3-2 to 3-5 in general.
26 1.7 dholland *
27 1.7 dholland * If anyone needs to update this comment please make sure the copy in
28 1.8 rillig * m68k/include/float.h also gets updated.
29 1.7 dholland */
30 1.7 dholland
31 1.2 christos #define LDBL_MANT_DIG 64
32 1.5 kleink #define LDBL_EPSILON 1.0842021724855044340E-19L
33 1.5 kleink #define LDBL_DIG 18
34 1.5 kleink #define LDBL_MIN_EXP (-16381)
35 1.3 christos #define LDBL_MIN 3.3621031431120935063E-4932L
36 1.5 kleink #define LDBL_MIN_10_EXP (-4931)
37 1.5 kleink #define LDBL_MAX_EXP 16384
38 1.5 kleink #define LDBL_MAX 1.1897314953572317650E+4932L
39 1.5 kleink #define LDBL_MAX_10_EXP 4932
40 1.5 kleink
41 1.4 kleink #include <sys/float_ieee754.h>
42 1.5 kleink
43 1.5 kleink #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
44 1.5 kleink !defined(_XOPEN_SOURCE) || \
45 1.5 kleink ((__STDC_VERSION__ - 0) >= 199901L) || \
46 1.5 kleink ((_POSIX_C_SOURCE - 0) >= 200112L) || \
47 1.5 kleink ((_XOPEN_SOURCE - 0) >= 600) || \
48 1.5 kleink defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
49 1.5 kleink #define DECIMAL_DIG 21
50 1.5 kleink #endif /* !defined(_ANSI_SOURCE) && ... */
51 1.1 fvdl
52 1.1 fvdl #endif /* _X86_FLOAT_H_ */
53