OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [stdlib/] [__exp10.c] - Blame information for rev 1773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
/*
2
 * compute 10**x by successive squaring.
3
 */
4
 
5
#include <_ansi.h>
6
 
7
double
8
_DEFUN (__exp10, (x),
9
        unsigned x)
10
{
11
  static _CONST double powtab[] =
12
  {1.0,
13
   10.0,
14
   100.0,
15
   1000.0,
16
   10000.0};
17
 
18
  if (x < (sizeof (powtab) / sizeof (double)))
19
      return powtab[x];
20
  else if (x & 1)
21
    {
22
      return 10.0 * __exp10 (x - 1);
23
    }
24
  else
25
    {
26
      double n = __exp10 (x / 2);
27
      return n * n;
28
    }
29
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.