| 1 |
/* { dg-options "-Wno-old-style-definition -O2 -mcmodel=small -fPIC" } */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-require-effective-target fpic } */ |
| 4 |
|
| 5 |
extern int __finite (double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); |
| 6 |
extern int __finitef (float __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); |
| 7 |
extern int __signbit (double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); |
| 8 |
extern int __signbitf (float __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); |
| 9 |
int |
| 10 |
__ecvt_r (value, ndigit, decpt, sign, buf, len) |
| 11 |
double value; |
| 12 |
int ndigit, *decpt, *sign, len; |
| 13 |
char *buf; |
| 14 |
{ |
| 15 |
if ((sizeof (value) == sizeof (float) ? __finitef (value) : __finite (value)) && value != 0.0) |
| 16 |
{ |
| 17 |
double d; |
| 18 |
double f = 1.0; |
| 19 |
d = -value; |
| 20 |
if (d < 1.0e-307) |
| 21 |
{ |
| 22 |
do |
| 23 |
{ |
| 24 |
f *= 10.0; |
| 25 |
} |
| 26 |
while (d * f < 1.0); |
| 27 |
} |
| 28 |
} |
| 29 |
if (ndigit <= 0 && len > 0) |
| 30 |
{ |
| 31 |
buf[0] = '\0'; |
| 32 |
*sign = (sizeof (value) == sizeof (float) ? __finitef (value) : __finite (value)) ? (sizeof (value) == sizeof (float) ? __signbitf (value) : __signbit (value)) != 0 : 0; |
| 33 |
} |
| 34 |
} |