home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / MATH.ZIP / HUGEVAL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  2.5 KB  |  71 lines

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