Last change
on this file since 577 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
414 bytes
|
Line | |
---|
1 | /* |
---|
2 | * compute 10**x by successive squaring. |
---|
3 | */ |
---|
4 | |
---|
5 | #include <_ansi.h> |
---|
6 | #include "std.h" |
---|
7 | |
---|
8 | double |
---|
9 | __exp10 (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 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.