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

  1. /*------------------------------------------------------------------------
  2.  * filename - log10l.cas
  3.  *
  4.  * function(s)
  5.  *        log10l - base 10 logarithm function of long double
  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. static  unsigned short   NANLOGL [5] = {0,0,0,0xC024, 0xFFFF};
  26.  
  27. /*--------------------------------------------------------------------------*
  28.  
  29. Name            log10l - base 10 logarithm function of long double
  30.  
  31. Usage           long double log10l(long double x);
  32.  
  33. Prototype in    math.h
  34.  
  35. Description     log10l calculates the base 10 logarithm of x, which  must be
  36.                 greater than zero.
  37.  
  38. Return value    log10l returns the base 10 logarithm of x.
  39.  
  40. *---------------------------------------------------------------------------*/
  41. #pragma warn -rvl
  42. #pragma warn -use
  43. long double _FARFUNC log10l (long double  x)
  44. {
  45. long double     temp;
  46.  
  47. asm     FLD     LONGDOUBLE (x)
  48.  
  49. asm     mov     ax, W0 (x [8])          /* get the exponent field */
  50. asm     shl     ax, 1
  51. asm     jz      l10_zero
  52. asm     jc      l10_imaginary
  53. asm     cmp     ax, 0FFFEh
  54. asm     je      l10_infinite
  55.  
  56. #ifdef _Windows
  57.         _f87_Log10();
  58. #else
  59. asm     _FAST_  (_FLOG10_)
  60. #endif
  61.  
  62. l10_end:
  63.         return;
  64.  
  65. l10_zero:
  66. asm     mov     si, SING
  67.         temp = -_LHUGE_VAL;
  68. asm     jmp     short   l10_complain
  69.  
  70. l10_infinite:
  71. asm     mov     si, OVERFLOW
  72.         temp = _LHUGE_VAL;
  73. asm     jmp     short   l10_complain
  74.  
  75. l10_imaginary:
  76. asm     mov     si, DOMAIN
  77.         temp = *((long double *) NANLOGL);
  78.  
  79. l10_complain:
  80. asm     FSTP    ST(0)                   /* pop x from stack */
  81. #pragma warn -ret
  82.         return  __matherrl (_SI, "log10l", &x, NULL, temp);
  83. #pragma warn .ret
  84. }
  85. #pragma warn .rvl
  86. #pragma warn .use
  87.