mathP.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:2k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* mathP.h - private definitions for math functions */
  2. /* Copyright 1992-2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01i,03oct01,to   use IEEE little endian for ARM
  7. 01h,23jan97,cdp  reverse words in double for ARM.
  8. 01g,22sep92,rrr  added support for c++
  9. 01f,04sep92,wmd  modified definition of DOUBLE for BIG/LITTLE ENDIAN architectures.
  10. 01e,30jul92,kdl  added fp type test macros; deleted declarations of unused
  11.  routines (isnan(), etc.); changed _d_type() to fpTypeGet();
  12.  deleted prototypes for _dNormalize, _finite, _upscale.
  13. 01d,30jul92,kdl  added DOUBLE union definition, from floatLib.c.
  14. 01c,08jul92,smb  added to clib library.
  15. 01b,04oct91,rrr  passed through the ansification filter
  16.   -fixed #else and #endif
  17.     -changed copyright notice
  18. 01a,14sep90,mcl  adapted from Berkeley.
  19. */
  20. #ifndef __INCmathPh
  21. #define __INCmathPh
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #define ZERO  0
  26. #define REAL  1
  27. #define INTEGER 2
  28. #define INF  3
  29. #define NAN  4
  30. #define isNan(num)  ((fpTypeGet (num, 0)) == NAN)
  31. #define isZero(num)  ((fpTypeGet (num, 0)) == ZERO)
  32. #define isInf(num)  ((fpTypeGet (num, 0)) == INF)
  33. typedef union
  34.     {
  35.     unsigned p_mant[2];
  36.     double p_double;
  37.     } __cv_type;
  38. #define p_mantlow p_mant[0]
  39. #define p_manthigh p_mant[1]
  40. typedef union /* DOUBLE */
  41.     {
  42.     double ddat;
  43. #if (_BYTE_ORDER == _BIG_ENDIAN)
  44.     struct
  45.         {
  46.         long l1;
  47.         long l2;
  48.         } ldat;
  49. #else
  50.     struct
  51.         {
  52.         long l2;
  53.         long l1;
  54.         } ldat;
  55. #endif /* _BYTE_ORDER == _BIG_ENDIAN */
  56.     } DOUBLE;
  57. /* function declarations */
  58. #if defined(__STDC__) || defined(__cplusplus)
  59. extern int fpTypeGet (double v, double *r);
  60. #else /* __STDC__ */
  61. extern int fpTypeGet();
  62. #endif /* __STDC__ */
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* __INCmathPh */