float.h revision 1.27
1/* $NetBSD: float.h,v 1.27 2025/10/07 02:15:36 nat Exp $ */ 2 3#ifndef _M68K_FLOAT_H_ 4#define _M68K_FLOAT_H_ 5 6#include <sys/featuretest.h> 7 8/* 9 * LDBL_MIN is half the x86 LDBL_MIN, even though both are 12-byte 10 * floats with the same base properties and both allegedly 11 * IEEE-compliant, because both these representations materialize the 12 * top (integer-part) bit of the significand. But on m68k if the 13 * exponent is 0 and the integer bit is set, it's a regular number, 14 * whereas on x86 it's called a pseudo-denormal and apparently treated 15 * as a denormal, so it doesn't count as a valid value for LDBL_MIN. 16 * 17 * If you are running a softloat userland LDBL_MIN is half that again. 18 * 19 * x86 citation: Intel 64 and IA-32 Architectures Software Developer's 20 * Manual, vol. 1 (Order Number: 253665-077US, April 2022), Sec. 8.2.2 21 * `Unsupported Double Extended-Precision Floating-Point Encodings 22 * and Pseudo-Denormals', p. 8-14. 23 * 24 * m86k citation: MC68881/MC68882 Floating-Point Coprocessor User's 25 * Manual, Second Edition (Prentice-Hall, 1989, apparently issued by 26 * Freescale), Section 3.2 `Binary Real Data formats', pg. 3-3 bottom 27 * in particular and pp. 3-2 to 3-5 in general. 28 * 29 * If anyone needs to update this comment please make sure the copy in 30 * x86/include/float.h also gets updated. 31 */ 32 33#if defined(__LDBL_MANT_DIG__) && \ 34 !(defined(__m68k__) && !defined(__HAVE_68881__)) 35#define LDBL_MANT_DIG __LDBL_MANT_DIG__ 36#define LDBL_EPSILON __LDBL_EPSILON__ 37#define LDBL_DIG __LDBL_DIG__ 38#define LDBL_MIN_EXP __LDBL_MIN_EXP__ 39#define LDBL_MIN __LDBL_MIN__ 40#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ 41#define LDBL_MAX_EXP __LDBL_MAX_EXP__ 42#define LDBL_MAX __LDBL_MAX__ 43#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ 44#elif !defined(__mc68010__) && !defined(__mcoldfire__) 45#define LDBL_MANT_DIG 64 46#define LDBL_EPSILON 1.0842021724855044340E-19L 47#define LDBL_DIG 18 48#if !defined(__HAVE_68881__) 49#define LDBL_MIN_EXP (-16382) 50#define LDBL_MIN 0.8405257857780233760E-4932L 51#else 52#define LDBL_MIN_EXP (-16381) 53#define LDBL_MIN 1.6810515715560467531E-4932L 54#endif 55#define LDBL_MIN_10_EXP (-4931) 56#define LDBL_MAX_EXP 16384 57#define LDBL_MAX 1.1897314953572317650E+4932L 58#define LDBL_MAX_10_EXP 4932 59#endif 60 61#include <sys/float_ieee754.h> 62 63#if !defined(__mc68010__) && !defined(__mcoldfire__) 64#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \ 65 !defined(_XOPEN_SOURCE) || \ 66 ((__STDC_VERSION__ - 0) >= 199901L) || \ 67 ((_POSIX_C_SOURCE - 0) >= 200112L) || \ 68 ((_XOPEN_SOURCE - 0) >= 600) || \ 69 defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE) 70#define DECIMAL_DIG 21 71#endif /* !defined(_ANSI_SOURCE) && ... */ 72#endif /* !__mc68010__ && !__mcoldfire__ */ 73 74#endif /* !_M68K_FLOAT_H_ */ 75