Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / stdlib / __exp10.c
blobcf223742b4a7cb833c1cacd428ae45a6eddca9cc
1 /*
2 * compute 10**x by successive squaring.
3 */
5 #include <_ansi.h>
6 #include "std.h"
8 double
9 __exp10 (unsigned x)
11 static const double powtab[] =
12 {1.0,
13 10.0,
14 100.0,
15 1000.0,
16 10000.0};
18 if (x < (sizeof (powtab) / sizeof (double)))
19 return powtab[x];
20 else if (x & 1)
22 return 10.0 * __exp10 (x - 1);
24 else
26 double n = __exp10 (x / 2);
27 return n * n;