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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc2/] [newlib/] [libc/] [stdlib/] [__exp10.c] - Blame information for rev 520

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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