#ifndef __FP_LOADED #define __FP_LOADED 1 /**************************************************************************** ** ** - ANSI C NCEG floating support ** ***************************************************************************** ** Header defined by NCEG Floating-Point C Extensions WG14/N319 X3J11/94-003 ***************************************************************************** ** ** Copyright 2000 Compaq Computer Corporation ** ** Compaq and the Compaq logo Registered in U.S. Patent and Trademark Office. ** ** Confidential computer software. Valid license from Compaq 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. ** ****************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** Relaxed refdef external model */ #pragma __extern_model __save #pragma __extern_model __relaxed_refdef /* ** Naturally align all structures */ #pragma __member_alignment __save #pragma __member_alignment /* ** HUGE_VAL is +infinity or double max. Note that D float has 53 bits of ** precision on AXP and 56 on VAX */ #if __G_FLOAT # define HUGE_VAL 8.988465674311578540726371186585e+307 #elif __IEEE_FLOAT # if defined (_IEEE_FP) && (__CRTL_VER >= 60200000) extern double decc$gt_dbl_infinity; # define HUGE_VAL decc$gt_dbl_infinity # else # define HUGE_VAL 1.7976931348623158e+308 # endif #else # ifdef __ALPHA # define HUGE_VAL 1.70141183460469213e+38 # else # define HUGE_VAL 1.70141183460469229e+38 # endif #endif /* ** HUGE_VALL is either +infinity or long double max. */ #if !__X_FLOAT # define HUGE_VALL HUGE_VAL #elif defined (_IEEE_FP) && (__CRTL_VER >= 60200000) extern long double decc$gx_long_dbl_infinity; # define HUGE_VALL decc$gx_long_dbl_infinity #else # define HUGE_VALL 1.189731495357231765085759326628007016196477e4932l #endif /* ** HUGE_VALF is either +infinity or float max for the correct type */ #if __G_FLOAT || __D_FLOAT # define HUGE_VALF 1.7014117e+38f #elif defined (_IEEE_FP) && (__CRTL_VER >= 60200000) extern float decc$gs_float_infinity; # define HUGE_VALF decc$gs_float_infinity #else # define HUGE_VALF 3.40282347e+38f #endif /* ** INFINITY is either +infinity, or a floating constant that overflows at ** compile-time. 1.8e308 is larger than DBL_MAX for D, G or IEEE T. */ #if defined(_IEEE_FP) && (__CRTL_VER >= 60200000) # define INFINITY decc$gt_dbl_infinity #else # define INFINITY 1.8e308 #endif /* ** Implementation's most efficient floating types at least as wide as float ** and double respectively. Both VAX and Alpha AXP are single/double ** architectures and so float and double are efficient types. */ typedef float float_t; typedef double double_t; /* ** NAN is defined to be a quiet NaN, if and only if quiet NaN is supported. */ #ifdef _IEEE_FP extern double decc$gt_dbl_nan; # define NAN decc$gt_dbl_nan #endif /* ** Alpha Only Constants for use with fp_classify ** ** fp_classify is a type-independent macro that uses the classify functions ** in . fp_classify returns one of FP_NAN, FP_INFINIT, FP_NORMAL ** FP_SUBNORMAL or FP_ZERO */ #ifdef __ALPHA # define FP_NAN 0 # define FP_INFINITE 1 # define FP_NORMAL 2 # define FP_SUBNORMAL 3 # define FP_ZERO 4 int fp_classf( float __x ); int fp_class( double __x ); int fp_classl( long double __x ); # define fp_classify(x) ((sizeof(x)==sizeof(float))?fp_classf(x)>>1:(sizeof(x)==sizeof(double))?fp_class(x)>>1:fp_classl(x)>>1) #endif #define __VALH(x) ((unsigned int *)&x)[1] #define __VALL(x) ((unsigned int *)&x)[0] /* ** signbit(x) -- nonzero iff size is negative (negative infinity, zeros and NaN's included) ** isfinite(x) -- nonzero iff x is finite (zero, subnormal or normal) ** isnormal(x) -- nonzero iff x is normal (not zero, subnormal, infinite or Nan) ** isnan(x) -- nonzero iff x is Not-A-Number (NaN) [defined only ** if not previously included */ #if __IEEE_FLOAT # define signbit(x) (__VALH(x) & 0x80000000) # define isfinite(x) ((__VALH(x) & 0x7ff00000) != 0x7ff00000 ) # define isnormal(x) ( ((__VALH(x) & 0x7ff00000) != 0x7ff00000) && ((__VALH(x) & 0x7ff00000) != 0)) ) # if !defined __MATH_LOADED || !defined __ALPHA # define isnan(x) ( ((__VALH(x) & 0x7ff00000) == 0x7ff00000) && ((__VALH(x) & 0xfffff) | __VALL(x)) ) # endif #else # define signbit(x) (__VALL(x) & 0x8000) # define isfinite(x) 1 # define isnormal(x) (x != 0) # if !defined __MATH_LOADED || !defined __ALPHA # define isnan(x) 0 # endif #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. */ #if __D_FLOAT && defined(__VAX) # define DECIMAL_DIG 18 #else # define DECIMAL_DIG 17 #endif /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __member_alignment __restore #pragma __extern_model __restore #pragma __standard #endif /* __FP_LOADED */ #ifndef __FP_CLASS_LOADED #define __FP_CLASS_LOADED 1 #ifdef __ALPHA /* Alpha only */ /**************************************************************************** ** ** - IEEE Std 754-1985 classification function return values ** ***************************************************************************** ** Header is nonstandard ***************************************************************************** ** ** Copyright Digital Equipment Corporation 1993, 1997. All rights reserved. ** ** Restricted Rights: Use, duplication, or disclosure by the U.S. ** Government is subject to restrictions as set forth in subparagraph ** (c) (1) (ii) of DFARS 252.227-7013, or in FAR 52.227-19, or in FAR ** 52.227-14 Alt. III, as applicable. ** ** This software is proprietary to and embodies the confidential ** technology of Digital Equipment Corporation. Possession, use, or ** copying of this software and media is authorized only pursuant to a ** valid written license from Digital or an authorized sublicensor. ** ****************************************************************************** */ /* ** This file uses non-ANSI-Standard features */ #pragma __nostandard /* ** Define the FP_ constants */ #define FP_SNAN 0 #define FP_QNAN 1 #define FP_POS_INF 2 #define FP_NEG_INF 3 #define FP_POS_NORM 4 #define FP_NEG_NORM 5 #define FP_POS_DENORM 6 #define FP_NEG_DENORM 7 #define FP_POS_ZERO 8 #define FP_NEG_ZERO 9 #pragma __standard #endif /* __ALPHA only */ #endif /* __FP_CLASS_LOADED */