#ifndef __FLOAT_LOADED #define __FLOAT_LOADED 1 /**************************************************************************** ** ** - Characteristics of floating types ** ***************************************************************************** ** Header introduced by the ANSI C Standard ***************************************************************************** ** * ** HPE CONFIDENTIAL. This software is confidential proprietary software * ** licensed by Hewlett Packard Enterprise Development, LP, and is not * ** authorized to be used, duplicated or disclosed to anyone without the * ** prior written permission of HPE. * ** Copyright 2019 Hewlett Packard Enterprise Development, LP * ** * ** VMS SOFTWARE, INC. CONFIDENTIAL. This software is confidential * ** proprietary software licensed by VMS Software, Inc., and is not * ** authorized to be used, duplicated or disclosed to anyone without * ** the prior written permission of VMS Software, Inc. * ** Copyright 2019-2020 VMS Software, Inc. * ** * ***************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif /* ** The following literals and routines are available on OpenVMS ** but only after V7.1 with /STANDARD=RELAXED or with C++. */ #if defined(__DECCXX) || (!defined _ANSI_C_SOURCE && (__CRTL_VER >= 70100000)) /* ** Values for the IEEE Rounding Modes (IEEE ANSI Values) ** ** RZ = Round toward zero (chopped) ** RN = Round toward nearest (default, normal) ** RP = Round toward plus infinity ** RM = Round toward minus infinity */ # define FP_RND_RZ 0 # define FP_RND_RN 1 # define FP_RND_RP 2 # define FP_RND_RM 3 /* ** IEEE Constants */ # ifdef _IEEE_FP # pragma __extern_model __save # pragma __extern_model __strict_refdef extern double decc$gt_dinfinity; extern double decc$gt_dqnan; extern double decc$gt_dsnan; extern float decc$gs_sinfinity; extern float decc$gs_sqnan; extern float decc$gs_ssnan; # if __X_FLOAT # if (__CRTL_VER >= 60200000) extern long double decc$gx_long_dbl_infinity; # endif extern long double decc$gx_long_dbl_qnan; extern long double decc$gx_long_dbl_snan; # endif # pragma __extern_model __restore # define DBL_INFINITY decc$gt_dinfinity # define DBL_QNAN decc$gt_dqnan # define DBL_SNAN decc$gt_dsnan # define FLT_INFINITY decc$gs_sinfinity # define FLT_QNAN decc$gs_sqnan # define FLT_SNAN decc$gs_ssnan # if __X_FLOAT # if (__CRTL_VER >= 60200000) # define LDBL_INFINITY decc$gx_long_dbl_infinity # else # define LDBL_INFINITY DBL_INFINITY # endif # define LDBL_QNAN decc$gx_long_dbl_qnan # define LDBL_SNAN decc$gx_long_dbl_snan # else # define LDBL_INFINITY DBL_INFINITY # define LDBL_QNAN DBL_QNAN # define LDBL_SNAN DBL_SNAN # endif # endif /* ** Macros to get decc$ names */ # if (__CRTL_VER < 70100000) # define write_rnd(__p1) decc$write_rnd(__p1) # define read_rnd decc$read_rnd # endif /* ** Functions to read and write floating point rounding mode */ unsigned int write_rnd(unsigned int __rnd); unsigned int read_rnd(void); #endif /* ** Operations and constants evaluate in the range and precision of double */ #define FLT_EVAL_METHOD 1 /* ** Rounding mode for floating point addition: */ #ifdef __BIASED_FLT_ROUNDS # define FLT_ROUNDS (__BIASED_FLT_ROUNDS-1) /* use compiler generated value, if present */ #else # define FLT_ROUNDS 1 #endif /* ** DECIMAL_DIG -- number of decimal digits such that conversion from double to ** string and back is the identify function if the conversion uses a string of ** DECIMAL_DIG digits. */ #define DECIMAL_DIG 17 /* ** Radix of exponent representation: */ #define FLT_RADIX 2 /* ** Number of FLT_RADIX digits in the mantissa including the hidden bit: */ #define __F_FLT_MANT_DIG 24 #define __G_DBL_MANT_DIG 53 #define __S_FLT_MANT_DIG 24 #define __T_FLT_MANT_DIG 53 #define __X_FLT_MANT_DIG 113 /* ** Number of decimal digits of precision: */ #define __F_FLT_DIG 6 #define __G_FLT_DIG 15 #define __S_FLT_DIG 6 #define __T_FLT_DIG 15 #define __X_FLT_DIG 33 /* ** Minimum negative integer such that FLT_RADIX raised to that power ** minus 1 is a normalized floating-point number: */ #define __F_FLT_MIN_EXP (-127) #define __G_FLT_MIN_EXP (-1023) #define __S_FLT_MIN_EXP (-125) #define __T_FLT_MIN_EXP (-1021) #define __X_FLT_MIN_EXP (-16381) /* ** Minimum negative integer such that 10 raised to that power is in the ** range of normalized floating-point numbers: */ #define __F_FLT_MIN_10_EXP (-38) #define __G_FLT_MIN_10_EXP (-308) #define __S_FLT_MIN_10_EXP (-37) #define __T_FLT_MIN_10_EXP (-307) #define __X_FLT_MIN_10_EXP (-4931) /* ** Maximum integer such that FLT_RADIX raised to that power minus 1 is a ** representable finite floating point number: */ #define __F_FLT_MAX_EXP 127 #define __G_FLT_MAX_EXP 1023 #define __S_FLT_MAX_EXP 128 #define __T_FLT_MAX_EXP 1024 #define __X_FLT_MAX_EXP 16384 /* ** Maximum integer such that 10 raised to that power is in the range of ** representable finite floating-point numbers: */ #define __F_FLT_MAX_10_EXP 38 #define __G_FLT_MAX_10_EXP 307 #define __S_FLT_MAX_10_EXP 38 #define __T_FLT_MAX_10_EXP 308 #define __X_FLT_MAX_10_EXP 4932 /* ** Maximum representable finite floating-point number: */ #define __F_FLT_MAX 1.7014117e+38f #define __G_FLT_MAX 8.98846567431157854e+307 #define __S_FLT_MAX 3.40282347e+38f #define __T_FLT_MAX 1.79769313486231570e+308 #define __X_FLT_MAX 1.189731495357231765085759326628007016196477e4932l /* ** The difference between 1.0 and the least value greater than 1.0 that ** is representable in the given floating-point type ** (i.e. 1.0 + epsilon != 1.0): */ #define __F_FLT_EPSILON ((float)(1.0 / (1 << 23))) #define __G_FLT_EPSILON (1.0 / (1 << 30) / (1 << 22)) #define __S_FLT_EPSILON 1.19209290e-07f #define __T_FLT_EPSILON 2.2204460492503131e-16 #define __X_FLT_EPSILON 1.9259299443872358530559779425849273185381e-34l /* ** Minimum normalized positive floating-point number: */ #define __F_FLT_MIN ((float) 2.93873587705571877e-39) #define __G_FLT_MIN 5.56268464626800346e-309 #define __S_FLT_MIN 1.17549435e-38f #define __T_FLT_MIN 2.2250738585072014e-308 #define __X_FLT_MIN ((long double) 3.3621031431120935062626778173217526025981e-4932l) /* ** Define the FLT values to be either the __S or __F values based on IEEE */ #if __IEEE_FLOAT # define FLT_MANT_DIG __S_FLT_MANT_DIG # define FLT_DIG __S_FLT_DIG # define FLT_MIN_EXP __S_FLT_MIN_EXP # define FLT_MIN_10_EXP __S_FLT_MIN_10_EXP # define FLT_MAX_EXP __S_FLT_MAX_EXP # define FLT_MAX_10_EXP __S_FLT_MAX_10_EXP # define FLT_MAX __S_FLT_MAX # define FLT_EPSILON __S_FLT_EPSILON # define FLT_MIN __S_FLT_MIN #else # define FLT_MANT_DIG __F_FLT_MANT_DIG # define FLT_DIG __F_FLT_DIG # define FLT_MIN_EXP __F_FLT_MIN_EXP # define FLT_MIN_10_EXP __F_FLT_MIN_10_EXP # define FLT_MAX_EXP __F_FLT_MAX_EXP # define FLT_MAX_10_EXP __F_FLT_MAX_10_EXP # define FLT_MAX __F_FLT_MAX # define FLT_EPSILON __F_FLT_EPSILON # define FLT_MIN __F_FLT_MIN #endif /* ** Define the DBL values to be either the __S or __F values based on IEEE */ #if __IEEE_FLOAT # define DBL_MANT_DIG __T_FLT_MANT_DIG # define DBL_DIG __T_FLT_DIG # define DBL_MIN_EXP __T_FLT_MIN_EXP # define DBL_MIN_10_EXP __T_FLT_MIN_10_EXP # define DBL_MAX_EXP __T_FLT_MAX_EXP # define DBL_MAX_10_EXP __T_FLT_MAX_10_EXP # define DBL_MIN __T_FLT_MIN #elif __G_FLOAT # define DBL_MANT_DIG __G_DBL_MANT_DIG # define DBL_DIG __G_FLT_DIG # define DBL_MIN_EXP __G_FLT_MIN_EXP # define DBL_MIN_10_EXP __G_FLT_MIN_10_EXP # define DBL_MAX_EXP __G_FLT_MAX_EXP # define DBL_MAX_10_EXP __G_FLT_MAX_10_EXP # define DBL_MIN __G_FLT_MIN #else # define DBL_MANT_DIG 56 # define DBL_DIG 16 # define DBL_MIN_EXP __F_FLT_MIN_EXP # define DBL_MIN_10_EXP __F_FLT_MIN_10_EXP # define DBL_MAX_EXP __F_FLT_MAX_EXP # define DBL_MAX_10_EXP __F_FLT_MAX_10_EXP # define DBL_MIN 2.93873587705571877e-39 #endif #if __IEEE_FLOAT # define DBL_MAX __T_FLT_MAX #elif __G_FLOAT # define DBL_MAX __G_FLT_MAX #else # define DBL_MAX 1.70141183460469213e+38 #endif #if __IEEE_FLOAT # define DBL_EPSILON __T_FLT_EPSILON #elif __G_FLOAT || __D_FLOAT # define DBL_EPSILON (1.0 / (1 << 20) / (1 << 16) / (1 << 16)) #else # define DBL_EPSILON (1.0 / (1 << 23) / (1 << 16) / (1 << 16)) #endif /* ** Define the LDBL values based on __X_FLOAT */ #if __X_FLOAT # define LDBL_MANT_DIG __X_FLT_MANT_DIG # define LDBL_DIG __X_FLT_DIG # define LDBL_MIN_EXP __X_FLT_MIN_EXP # define LDBL_MIN_10_EXP __X_FLT_MIN_10_EXP # define LDBL_MAX_EXP __X_FLT_MAX_EXP # define LDBL_MAX_10_EXP __X_FLT_MAX_10_EXP # define LDBL_MAX __X_FLT_MAX # define LDBL_EPSILON __X_FLT_EPSILON # define LDBL_MIN 3.3621031431120935062626778173217526025981e-4932l #else # if defined (__clang__) # define LDBL_MANT_DIG __LDBL_MANT_DIG__ # define LDBL_DIG __LDBL_DIG__ # define LDBL_MIN_EXP __LDBL_MIN_EXP__ # define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ # define LDBL_MAX_EXP __LDBL_MAX_EXP__ # define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ # define LDBL_MAX __LDBL_MAX__ # define LDBL_EPSILON __LDBL_EPSILON__ # define LDBL_MIN __LDBL_MIN__ # else # define LDBL_MANT_DIG DBL_MANT_DIG # define LDBL_DIG DBL_DIG # define LDBL_MIN_EXP DBL_MIN_EXP # define LDBL_MIN_10_EXP DBL_MIN_10_EXP # define LDBL_MAX_EXP DBL_MAX_EXP # define LDBL_MAX_10_EXP DBL_MAX_10_EXP # define LDBL_MAX DBL_MAX # define LDBL_EPSILON DBL_EPSILON # define LDBL_MIN DBL_MIN # endif #endif #ifdef __cplusplus } #endif #pragma __standard #endif /* __FLOAT_LOADED */