| 1 |
/** |
| 2 |
* This file has no copyright assigned and is placed in the Public Domain. |
| 3 |
* This file is part of the mingw-w64 runtime package. |
| 4 |
* No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 |
*/ |
| 6 |
#include <math.h> |
| 7 |
#include <errno.h> |
| 8 |
|
| 9 |
double ldexp(double x, int expn) |
| 10 |
{ |
| 11 |
double res = 0.0; |
| 12 |
if (!isfinite (x) || x == 0.0) |
| 13 |
return x; |
| 14 |
|
| 15 |
__asm__ __volatile__ ("fscale" |
| 16 |
: "=t" (res) |
| 17 |
: "0" (x), "u" ((double) expn)); |
| 18 |
|
| 19 |
if (!isfinite (res) || res == 0.0L) |
| 20 |
errno = ERANGE; |
| 21 |
|
| 22 |
return res; |
| 23 |
} |