#ifndef __FLOAT_LOADED #define __FLOAT_LOADED 1 /**************************************************************************** ** ** - Characteristics of floating types ** ***************************************************************************** ** Header introduced by the ANSI C Standard ***************************************************************************** ** ** Copyright 2004 Hewlett-Packard Development Company, L.P. ** ** Confidential computer software. Valid license from HP and/or ** its subsidiaries required for possession, use, or copying. ** ** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, ** Computer Software Documentation, and Technical Data for Commercial ** Items are licensed to the U.S. Government under vendor's standard ** commercial license. ** ** Neither HP nor any of its subsidiaries shall be liable for technical ** or editorial errors or omissions contained herein. The information ** in this document is provided "as is" without warranty of any kind and ** is subject to change without notice. The warranties for HP products ** are set forth in the express limited warranty statements accompanying ** such products. Nothing herein should be construed as constituting an ** additional warranty. ** ***************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif /* ** The following literals and routines are available on OpenVMS for ** Alpha, but only after OpenVMS V7.1 or with C++. */ #if !defined __VAX # 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 #endif /* ** 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 /* ** 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 #if !defined(__VAX) #define __S_FLT_MANT_DIG 24 #define __T_FLT_MANT_DIG 53 #define __X_FLT_MANT_DIG 113 #endif /* ** Number of decimal digits of precision: */ #define __F_FLT_DIG 6 #define __G_FLT_DIG 15 #if !defined(__VAX) #define __S_FLT_DIG 6 #define __T_FLT_DIG 15 #define __X_FLT_DIG 33 #endif /* ** 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) #if !defined(__VAX) #define __S_FLT_MIN_EXP (-125) #define __T_FLT_MIN_EXP (-1021) #define __X_FLT_MIN_EXP (-16381) #endif /* ** 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) #if !defined(__VAX) #define __S_FLT_MIN_10_EXP (-37) #define __T_FLT_MIN_10_EXP (-307) #define __X_FLT_MIN_10_EXP (-4931) #endif /* ** 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 #if !defined(__VAX) #define __S_FLT_MAX_EXP 128 #define __T_FLT_MAX_EXP 1024 #define __X_FLT_MAX_EXP 16384 #endif /* ** 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 #if !defined(__VAX) #define __S_FLT_MAX_10_EXP 38 #define __T_FLT_MAX_10_EXP 308 #define __X_FLT_MAX_10_EXP 4932 #endif /* ** Maximum representable finite floating-point number: */ #define __F_FLT_MAX 1.7014117e+38f #define __G_FLT_MAX 8.98846567431157854e+307 #if !defined(__VAX) #define __S_FLT_MAX 3.40282347e+38f #define __T_FLT_MAX 1.79769313486231570e+308 #if defined(__DECCXX) && defined(__ia64) && !defined(__DECFIX_CXXC_BUGS9857) /* Temporary IPF workaround for __X_FLT_MAX: */ #define __X_FLT_MAX 1.1897314953572317650213E+4932L #else #define __X_FLT_MAX 1.189731495357231765085759326628007016196477e4932l #endif #endif /* ** 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)) #if !defined(__VAX) #define __S_FLT_EPSILON 1.19209290e-07f #define __T_FLT_EPSILON 2.2204460492503131e-16 #define __X_FLT_EPSILON 1.9259299443872358530559779425849273185381e-34l #endif /* ** Minimum normalized positive floating-point number: */ #define __F_FLT_MIN ((float) 2.93873587705571877e-39) #define __G_FLT_MIN 5.56268464626800346e-309 #if !defined(__VAX) #define __S_FLT_MIN 1.17549435e-38f #define __T_FLT_MIN 2.2250738585072014e-308 #define __X_FLT_MIN ((long double) 3.3621031431120935062626778173217526025981e-4932l) #endif /* ** 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 # if defined(__VAX) # define DBL_MAX 1.70141183460469229e+38 # else # define DBL_MAX 1.70141183460469213e+38 # endif #endif #if __IEEE_FLOAT # define DBL_EPSILON __T_FLT_EPSILON #elif __G_FLOAT || (__D_FLOAT && !defined(__VAX)) # 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 # 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 #ifdef __cplusplus } #endif #pragma __standard #endif /* __FLOAT_LOADED */