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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [stdlib/] [__exp10.c] - Blame information for rev 309

Go to most recent revision | 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.