/*
 * |-----------------------------------------------------------|
 * | Copyright (c) 1991, 1990 MIPS Computer Systems, Inc.      |
 * | All Rights Reserved                                       |
 * |-----------------------------------------------------------|
 * |          Restricted Rights Legend                         |
 * | Use, duplication, or disclosure by the Government is      |
 * | subject to restrictions as set forth in                   |
 * | subparagraph (c)(1)(ii) of the Rights in Technical        |
 * | Data and Computer Software Clause of DFARS 252.227-7013.  |
 * |         MIPS Computer Systems, Inc.                       |
 * |         950 DeGuigne Avenue                               |
 * |         Sunnyvale, California 94088-3650, USA             |
 * |-----------------------------------------------------------|
 */
#ident	"$Header: ecvt.c,v 1.7.2.1 92/06/24 13:59:56 marker Exp $"

/* Support obsolete interfaces */

#define	NDIG 82
static char buffer[NDIG+2];

char *
ecvt (arg, ndigits, decpt, sign)
    register double arg;
    register int ndigits, *decpt, *sign;
{
    if (ndigits > 17) {
	register char *p, *e;
	*decpt = _dtoa (buffer, 17, arg, 0) + 1;
	for (p = buffer+18, e = buffer + 1 + (ndigits > NDIG ? NDIG : ndigits);
	     p != e; ) *p++ = '0';
	*p++ = '\0';
    }
    else if (ndigits <= 0) {
	*decpt = _dtoa (buffer, 1, arg, 0) + 1;
	buffer[1] = '\0';
    }
    else {
	*decpt = _dtoa (buffer, ndigits, arg, 0) + 1;
    }
    *sign = buffer[0] == '-';
    return buffer+1;
}

char *
fcvt (arg, ndigits, decpt, sign)
    register double arg;
    register int ndigits, *decpt, *sign;
{
    *decpt = _dtoa (buffer, ndigits, arg, 1) + 1;
    *sign = buffer[0] == '-';
    return buffer+1;
}
