/* Compatibility functions for floating point formatting, reentrant versions.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
if (*sign)
value = -value;
}
+ else
+ /* Value is Inf or NaN. */
+ *sign = 0;
+
+ if (ndigit <= 0)
+ {
+ if (len > 0)
+ buf[0] = '\0';
+ *decpt = 0;
+ return 0;
+ }
n = snprintf (buf, len, "%.*" FLOAT_FMT_FLAG "f", ndigit, value);
if (n < 0)
*decpt = i;
if (i == 0)
- {
- /* Value is Inf or NaN. */
- *sign = 0;
- return 0;
- }
+ /* Value is Inf or NaN. */
+ return 0;
if (i < n)
{
++i;
while (i < n && !isdigit (buf[i]));
memmove (&buf[*decpt], &buf[i], n - i);
- buf[n - (i - *decpt)] = 0;
+ buf[n - (i - *decpt)] = '\0';
}
return 0;