11.27Snat/* $NetBSD: float.h,v 1.27 2025/10/07 02:15:36 nat Exp $ */ 21.10Sjtc 31.5Schopps#ifndef _M68K_FLOAT_H_ 41.6Smycroft#define _M68K_FLOAT_H_ 51.1Scgd 61.24Sriastrad#include <sys/featuretest.h> 71.24Sriastrad 81.22Sdholland/* 91.22Sdholland * LDBL_MIN is half the x86 LDBL_MIN, even though both are 12-byte 101.22Sdholland * floats with the same base properties and both allegedly 111.22Sdholland * IEEE-compliant, because both these representations materialize the 121.26Sriastrad * top (integer-part) bit of the significand. But on m68k if the 131.26Sriastrad * exponent is 0 and the integer bit is set, it's a regular number, 141.26Sriastrad * whereas on x86 it's called a pseudo-denormal and apparently treated 151.26Sriastrad * as a denormal, so it doesn't count as a valid value for LDBL_MIN. 161.22Sdholland * 171.27Snat * If you are running a softloat userland LDBL_MIN is half that again. 181.27Snat * 191.22Sdholland * x86 citation: Intel 64 and IA-32 Architectures Software Developer's 201.22Sdholland * Manual, vol. 1 (Order Number: 253665-077US, April 2022), Sec. 8.2.2 211.22Sdholland * `Unsupported Double Extended-Precision Floating-Point Encodings 221.22Sdholland * and Pseudo-Denormals', p. 8-14. 231.22Sdholland * 241.22Sdholland * m86k citation: MC68881/MC68882 Floating-Point Coprocessor User's 251.22Sdholland * Manual, Second Edition (Prentice-Hall, 1989, apparently issued by 261.22Sdholland * Freescale), Section 3.2 `Binary Real Data formats', pg. 3-3 bottom 271.22Sdholland * in particular and pp. 3-2 to 3-5 in general. 281.22Sdholland * 291.22Sdholland * If anyone needs to update this comment please make sure the copy in 301.23Srillig * x86/include/float.h also gets updated. 311.22Sdholland */ 321.22Sdholland 331.25Snat#if defined(__LDBL_MANT_DIG__) && \ 341.25Snat !(defined(__m68k__) && !defined(__HAVE_68881__)) 351.20Smatt#define LDBL_MANT_DIG __LDBL_MANT_DIG__ 361.20Smatt#define LDBL_EPSILON __LDBL_EPSILON__ 371.20Smatt#define LDBL_DIG __LDBL_DIG__ 381.20Smatt#define LDBL_MIN_EXP __LDBL_MIN_EXP__ 391.20Smatt#define LDBL_MIN __LDBL_MIN__ 401.20Smatt#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ 411.20Smatt#define LDBL_MAX_EXP __LDBL_MAX_EXP__ 421.20Smatt#define LDBL_MAX __LDBL_MAX__ 431.20Smatt#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ 441.20Smatt#elif !defined(__mc68010__) && !defined(__mcoldfire__) 451.12Smycroft#define LDBL_MANT_DIG 64 461.17Skleink#define LDBL_EPSILON 1.0842021724855044340E-19L 471.17Skleink#define LDBL_DIG 18 481.27Snat#if !defined(__HAVE_68881__) 491.27Snat#define LDBL_MIN_EXP (-16382) 501.27Snat#define LDBL_MIN 0.8405257857780233760E-4932L 511.27Snat#else 521.17Skleink#define LDBL_MIN_EXP (-16381) 531.17Skleink#define LDBL_MIN 1.6810515715560467531E-4932L 541.27Snat#endif 551.17Skleink#define LDBL_MIN_10_EXP (-4931) 561.17Skleink#define LDBL_MAX_EXP 16384 571.17Skleink#define LDBL_MAX 1.1897314953572317650E+4932L 581.17Skleink#define LDBL_MAX_10_EXP 4932 591.18Skleink#endif 601.17Skleink 611.16Skleink#include <sys/float_ieee754.h> 621.17Skleink 631.20Smatt#if !defined(__mc68010__) && !defined(__mcoldfire__) 641.17Skleink#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \ 651.17Skleink !defined(_XOPEN_SOURCE) || \ 661.17Skleink ((__STDC_VERSION__ - 0) >= 199901L) || \ 671.17Skleink ((_POSIX_C_SOURCE - 0) >= 200112L) || \ 681.17Skleink ((_XOPEN_SOURCE - 0) >= 600) || \ 691.17Skleink defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE) 701.17Skleink#define DECIMAL_DIG 21 711.17Skleink#endif /* !defined(_ANSI_SOURCE) && ... */ 721.20Smatt#endif /* !__mc68010__ && !__mcoldfire__ */ 731.5Schopps 741.12Smycroft#endif /* !_M68K_FLOAT_H_ */ 75