/* ISO C Runtime Library Copyright (c) 1983-2022 Green Hills Software, Inc. This program is the property of Green Hills Software, Inc, its contents are proprietary information and no part of it is to be disclosed to anyone except employees of Green Hills Software, Inc., or as agreed in writing signed by the President of Green Hills Software, Inc. */ #ifndef _FLOAT_H #ifdef __ghs__ #pragma ghs startnomisra #if !defined(__GHS_INST_PRO_EPI_IN_C_HEADERS) #pragma ghs instrument_prologue_epilogue push off #endif #endif #define _FLOAT_H #if !defined(__NoFloat) #define FLT_RADIX 2 /* * R3900 single precision rounds to zero in hardware. * But R3900 double precision rounds to nearest in software. * ANSI lacks this specific case, so use -1 which means indeterminate. */ #if defined(__mips) && defined(__R3900__) && !defined(__SoftwareFloat) #define FLT_ROUNDS -1 #else #define FLT_ROUNDS 1 /* most systems implement round to nearest */ #endif #ifdef FLT_EVAL_METHOD /* this is repeated in math.h and float.h */ #elif defined(__rs6000c) && !defined(__ghs_fprecise) /* PPC RS6000c evaluates floats and doubles in 64-bit arithmatic expressions*/ # define FLT_EVAL_METHOD 1 #elif (defined(__m68020) || defined(__m68030) || defined(__i386) || defined(__x86_64__)) && \ !defined(__SoftwareDouble) && !defined(__AMD64_ABI__) && \ (!defined(__ghs_fprecise) || defined(__GLIBC__)) /* 68020, 68030, and i386 use 80 bit precision. When __ghs_fprecise is * on, the compiler generates extra code to round precisely. * GNU defines both float_t and double_t as long double, even when * __ghs_fprecise is on. */ # define FLT_EVAL_METHOD (-1) #else # define FLT_EVAL_METHOD 0 #endif #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ (defined(__cplusplus) && __cplusplus >= 201103L) #define __GHS_WANT_C11_FLOAT_MACROS #endif #define FLT_MANT_DIG (24) #define FLT_EPSILON (1.1920929e-7f) #define FLT_DIG (6) #define FLT_MIN_EXP (-125) #define FLT_MIN (1.175494350822287508e-38f) #define FLT_MIN_10_EXP (-37) #define FLT_MAX_EXP (128) #define FLT_MAX (3.40282347e+38f) #define FLT_MAX_10_EXP (38) #define __GHS_FLT_SUB_MIN (1.401298464324817071e-45f) #define __GHS_FLT_DECIMAL_DIG (9) /* ceil(1 + FLT_MANT_DIG * log_10(2)) */ #if defined(__NoDouble) #elif defined(__FloatSingle) #define DBL_MANT_DIG (24) #define DBL_EPSILON (1.1920929e-7) #define DBL_DIG (6) #define DBL_MIN_EXP (-125) #define DBL_MIN (1.175494350822287508e-38) #define DBL_MIN_10_EXP (-37) #define DBL_MAX_EXP (128) #define DBL_MAX (3.40282347e+38) #define DBL_MAX_10_EXP (38) #define __GHS_DBL_SUB_MIN (1.401298464324817071e-45) #define __GHS_DBL_DECIMAL_DIG __GHS_FLT_DECIMAL_DIG #define LDBL_MANT_DIG (24) #define LDBL_EPSILON (1.1920929e-7L) #define LDBL_DIG (6) #define LDBL_MIN_EXP (-125) #define LDBL_MIN (1.175494350822287508e-38L) #define LDBL_MIN_10_EXP (-37) #define LDBL_MAX_EXP (128) #define LDBL_MAX (3.40282347e+38L) #define LDBL_MAX_10_EXP (38) #define __GHS_LDBL_SUB_MIN (1.401298464324817071e-45L) #define __GHS_LDBL_DECIMAL_DIG __GHS_FLT_DECIMAL_DIG #else /* !__FloatSingle */ #define DBL_MANT_DIG (53) #define DBL_EPSILON (2.2204460492503131e-16) #define DBL_DIG (15) #define DBL_MIN_EXP (-1021) #define DBL_MIN (2.2250738585072014e-308) #define DBL_MIN_10_EXP (-307) #define DBL_MAX (1.7976931348623157e+308) #define DBL_MAX_EXP (1024) #define DBL_MAX_10_EXP (308) #define __GHS_DBL_SUB_MIN (4.94065645841246544176568792868e-324) #define __GHS_DBL_DECIMAL_DIG (17) /* ceil(1 + DBL_MANT_DIG * log_10(2)) */ #if __LDBL_SIZE == 16 && defined(__LDBL_IS_DBL_DBL) /* Reference: C99(n1256) and C99RationaleV5.10, both in Sec 5.2.4.2.2 */ #define LDBL_MANT_DIG (106) #define LDBL_EPSILON (4.94065645841246544176568792868221372e-324L) #define LDBL_DIG (31) #define LDBL_MIN (2.00416836000897277799610805135016205e-292L) #define LDBL_MIN_EXP (-968) #define LDBL_MIN_10_EXP (-291) #define LDBL_MAX (1.79769313486231580793728971405301199e+308L) #define LDBL_MAX_EXP (1024) #define LDBL_MAX_10_EXP (308) #if defined(__GHS_WANT_C11_FLOAT_MACROS) #error "C11 not supported on any __LDBL_IS_DBL_DBL target" #endif #elif (__LDBL_SIZE == 12) || (__LDBL_SIZE == 16) # define LDBL_MANT_DIG (64) # define LDBL_EPSILON (1.08420217248550443400745280086994171142578125e-19L) # define LDBL_DIG (18) # define LDBL_MIN_EXP (-16381) # define LDBL_MIN (3.36210314311209350626e-4932L) # define LDBL_MIN_10_EXP (-4931) # define LDBL_MAX (1.18973149535723176502e+4932L) # define LDBL_MAX_EXP (16384) # define LDBL_MAX_10_EXP (4932) #define __GHS_LDBL_SUB_MIN (3.645199531882474602528405933619419816399e-4951L) #define __GHS_LDBL_DECIMAL_DIG (21) /* ceil(1 + LDBL_MANT_DIG * log_10(2)) */ #else /* long double same size as double, but with L suffix */ # define LDBL_MANT_DIG (53) # define LDBL_EPSILON (2.2204460492503131e-16L) # define LDBL_DIG (15) # define LDBL_MIN_EXP (-1021) # define LDBL_MIN (2.2250738585072014e-308L) # define LDBL_MIN_10_EXP (-307) # define LDBL_MAX (1.7976931348623157e+308L) # define LDBL_MAX_EXP (1024) # define LDBL_MAX_10_EXP (308) #define __GHS_LDBL_SUB_MIN (4.94065645841246544176568792868e-324L) #define __GHS_LDBL_DECIMAL_DIG (17) /* ceil(1 + LDBL_MANT_DIG * log_10(2)) */ #endif #endif /* !__FloatSingle */ #if defined(__GHS_WANT_C11_FLOAT_MACROS) #if defined(__FLT_HAS_SUBNORM) #define FLT_HAS_SUBNORM (__FLT_HAS_SUBNORM) #else #define FLT_HAS_SUBNORM (-1) #endif #if FLT_HAS_SUBNORM == 1 #define FLT_TRUE_MIN __GHS_FLT_SUB_MIN #else #define FLT_TRUE_MIN FLT_MIN #endif #define FLT_DECIMAL_DIG __GHS_FLT_DECIMAL_DIG #if !defined(__NoDouble) #if defined(__DBL_HAS_SUBNORM) #define DBL_HAS_SUBNORM (__DBL_HAS_SUBNORM) #else #define DBL_HAS_SUBNORM (-1) #endif #if DBL_HAS_SUBNORM == 1 #define DBL_TRUE_MIN __GHS_DBL_SUB_MIN #else #define DBL_TRUE_MIN DBL_MIN #endif #define DBL_DECIMAL_DIG __GHS_DBL_DECIMAL_DIG /* long double subnormal support same as double on all targets, so uses the * same driver defines. */ #if defined(__DBL_HAS_SUBNORM) #define LDBL_HAS_SUBNORM (__DBL_HAS_SUBNORM) #else #define LDBL_HAS_SUBNORM (-1) #endif #if LDBL_HAS_SUBNORM == 1 #define LDBL_TRUE_MIN __GHS_LDBL_SUB_MIN #else #define LDBL_TRUE_MIN LDBL_MIN #endif #define LDBL_DECIMAL_DIG __GHS_LDBL_DECIMAL_DIG #endif #if defined(__FP16_BIT) # if defined(__HLF_HAS_SUBNORM) # define HLF_HAS_SUBNORM (__HLF_HAS_SUBNORM) # else # define HLF_HAS_SUBNORM (-1) # endif # if HLF_HAS_SUBNORM == 1 # define HLF_TRUE_MIN (5.9604645e-8f) # else # define HLF_TRUE_MIN HLF_MIN # endif # define HLF_DECIMAL_DIG 5 /* ceil(1 + HLF_MANT_DIG * log_10(2)) */ #endif #undef __GHS_WANT_C11_FLOAT_MACROS #endif #if defined(__FP16_BIT) # define HLF_MANT_DIG (11) # define HLF_EPSILON (0.0009765625f) # define HLF_DIG (3) # define HLF_MIN_EXP (-13) # define HLF_MIN (6.10351562e-05f) # define HLF_MIN_10_EXP (-4) # define HLF_MAX_EXP (16) # define HLF_MAX (65504.0f) # define HLF_MAX_10_EXP (4) #endif /* DECIMAL_DIG is the same as __GHS__DECIMAL_DIG for the largest * floating-point type. */ #ifndef DECIMAL_DIG #if defined(__NoDouble) #define DECIMAL_DIG __GHS_FLT_DECIMAL_DIG #else #define DECIMAL_DIG __GHS_LDBL_DECIMAL_DIG #endif #endif #endif /* !defined(__NoFloat) */ #ifdef __ghs__ #if !defined(__GHS_INST_PRO_EPI_IN_C_HEADERS) #pragma ghs instrument_prologue_epilogue pop #endif #pragma ghs endnomisra #endif #endif /* _FLOAT_H */