home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 2.ddi / MATHSRC.ZIP / SINL.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  2.0 KB  |  79 lines

  1. /*------------------------------------------------------------------------
  2.  * filename - sinl.cas
  3.  *
  4.  * function(s)
  5.  *        sinl - long double trigonometric sine function
  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. #pragma inline
  18. #include <asmrules.h>
  19.  
  20. #include <_math.h>
  21. #include <math.h>
  22. #include <errno.h>
  23. #include <stddef.h>
  24.  
  25.  
  26. static  unsigned short   NANTRIGL [5] = {0,0,0,0xC021, 0x7FFF};
  27.  
  28. /*--------------------------------------------------------------------------*
  29.  
  30. Name            sinl - long double trigonometric sine function
  31.  
  32. Usage           long double sinl(long double x);
  33.  
  34. Prototype in    math.h
  35.  
  36. Description     sinl  returns  the  sine  of  the  input  value.  Angles are
  37.                 specified in radians.
  38.  
  39. Return value    sinl returns a value in range -1 to 1.
  40.                 For very  large arguments (magnitude 2^63  radians or more)
  41.                 there  is no  precision. This  is "silent",  sinlce the ANSI
  42.                 spec allows no error return for this function.
  43.  
  44. *---------------------------------------------------------------------------*/
  45. #pragma warn -rvl
  46. long double _FARFUNC sinl (long double x)
  47. {
  48. asm     FLD     LONGDOUBLE (x)
  49.  
  50. asm     mov     ax, 7FFFh
  51. asm     and     ax, W0 (x [8])          /* extract the exponent field */
  52. asm     cmp     ax, 63 + 3FFFh          /* biased version of exponent 63 */
  53. asm     jae     sinl_tooLarge
  54.  
  55. #ifdef _Windows
  56.         _f87_Sine();
  57. #else
  58.         if (_8087 >= 3)
  59.         {
  60. asm     db      OPCODE_FSIN
  61.         }
  62.         else
  63.         {
  64. asm     _FAST_  (_FSIN_)
  65.         }
  66. #endif
  67.  
  68. sinl_end:
  69.         return;
  70.  
  71.  
  72. sinl_tooLarge:
  73. asm     FSTP    ST (0)                  /* pop x from stack */
  74. #pragma warn -ret
  75.         return  __matherrl (TLOSS, "sinl", &x, NULL, *((long double *) NANTRIGL));
  76. #pragma warn .ret
  77. }
  78. #pragma warn .rvl
  79.