home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / MATHSRC.ZIP / HUGEVAL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.1 KB  |  69 lines

  1. /*------------------------------------------------------------------------
  2.  * filename - hugeval.c
  3.  *
  4.  * function(s)
  5.  *        none
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. /*--------------------------------------------------------------------------*
  18.  
  19. Constants for HUGE_VAL and related constants.
  20.  
  21. Some numbers are stored as global data items either because
  22. it is difficult to represent them in ASCII form, or because
  23. the program may wish to change them.
  24.  
  25. The rationale for the maximum numbers is that these are the
  26. largest "representable" numbers in the format.  INF and NAN
  27. are not considered representable.  It is perfectly valid to
  28. consider these representable, just not traditional.  For some
  29. applications it is indeed preferable, and it may be the default
  30. for some future release of Turbo C.
  31.  
  32. Approximate decimal values are:
  33.  
  34.         _huge_flt                       3.40282347E+38F
  35.         _huge_dble              1.7976931348623158E+308
  36.         _huge_ldble             1.189731495357232E+4932L
  37.         _tiny_ldble             3.362103143112094E-4932L
  38.  
  39. Declarations are in <math.h> and in <float.h>.
  40.  
  41. _indefinite is not used, and provided only for the convenience
  42. of those using INFs and NANs.  Declare it with
  43.  
  44.         extern float cdecl _indefinite;
  45.  
  46. Its value is the NAN preferred by the 8087 chip.
  47.  
  48. *---------------------------------------------------------------------------*/
  49.  
  50. #define UsingINF        0
  51.  
  52. #if     UsingINF
  53.  
  54. /* +INF in various formats */
  55. unsigned short _huge_flt[] = { 0, 0x7F80 };
  56. unsigned short _huge_dble[] = { 0, 0, 0, 0x7FF0 };
  57. unsigned short _huge_ldble[] = { 0, 0, 0, 0x8000, 0x7FFF };
  58.  
  59. #else
  60.  
  61. unsigned short _huge_flt[] = { -1, 0x7F7F };
  62. unsigned short _huge_dble[] = { -1, -1, -1, 0x7FEF };
  63. unsigned short _huge_ldble[] = { -1, -1, -1, -1, 0x7FFE };
  64.  
  65. #endif
  66.  
  67. unsigned short _indefinite[] = { 0, 0x7FC0 };
  68. unsigned short _tiny_ldble[] = { 0, 0, 0, 0x8000, 1 };
  69.