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

  1. /*------------------------------------------------------------------------
  2.  * filename - pow10d.c
  3.  *
  4.  * function(s)
  5.  *        pow10 - power function, 10^p
  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. #include <_math.h>
  17. #include <math.h>
  18.  
  19. /*--------------------------------------------------------------------------*
  20.  
  21. Name            pow10 - power function, 10^p
  22.  
  23. Usage           double  pow10(int  p);
  24.  
  25. Prototype in    math.h
  26.  
  27. Description     Calculate 10  raised to power.  A lookup table  is used for
  28.                 values  from  10  through  10^7,  then this is augmented by
  29.                 multiplying with  table entries for  10^8/16/32/64/128/256,
  30.                 512/1024/2048/4096 which allows any power up to the
  31.                 implementation limit of 4932.
  32.                 The usual range of double precision is  10e308 but pow10
  33.                 has a wider  range so that it can be used for long double
  34.                 calculations when the result is retrieved off the TOS
  35.                 explicitly by inline code doing a store of an 80 bit #.
  36.  
  37.                 Negative powers are provided by a final division.
  38.  
  39.                 All registers  are preserved except   AX ! This  is done to
  40.                 enable  use by  xcvt(), which  was designed  to assume  its
  41.                 registers will be undisturbed.
  42.  
  43. Return value    pow10 returns 10^p.
  44.  
  45. *---------------------------------------------------------------------------*/
  46.  
  47. double  _FARFUNC pow10  (int  p)
  48. {
  49.     return ((double)__pow10(p));
  50. }
  51.