/* DEC	*DivideDecimal(pDst,pSrc1,pSrc2);
 *
 * ARGUMENT
 *	DEC	*pDst;
 *	DEC	*pSrc1,pSrc2;
 *
 * DESCRIPTION
 *	Divides	pSrc1 by pSrc2,	storing	the result in pDst.  The quotient is
 *  calculated to as much accuracy as posssible, subject to the	constraint
 *  that its implied decimal must lie between MINID and	MAXID.
 *
 * SIDE	EFFECTS
 *	pDst is	indeterminate on underflow or overflow.
 *	GM_OVERFLOW:   quotient	too large.
 *	GM_UNDERFLOW:  pSrc1 !=	0, pSrc2 != 0, pDst = 0.
 *
 * RETURNS
 *	Returns	pointer	to pDst	if successful, otherwise a GM_NULL. The
 *   type error	(GM_OVERFLOW, GM_UNDERFLOW, GM_NOMEMORY) is in wGMError
 *   if	wGMError doesn't contain a previous error.
 *
 * POSSIBLE ERROR CODES
 *
 *	GM_NULLPOINTER
 *	GM_OVERFLOW
 *	GM_UNDERFLOW
 *	GM_DIV0
 *
 * AUTHOR
 *  Jared Levy	 05-JAN-1987  17:30
 *   Copyright (C) 1987-1990 Greenleaf Software	Inc.  All rights reserved.
 *
 * MODIFICATIONS
 *
 */

#include <stdio.h>
#include "gmsystem.h"

DEC	*DivideDecimal(pDst,pSrc1,pSrc2)
DEC	*pDst;
DEC	*pSrc1,*pSrc2;
{
	int	i;

	_MacStart(GM_DDIV);

	_MacInVarD(pSrc1);
	_MacInVarD(pSrc2);
	_MacOutVarD(pDst);

	i = _DivDecFast(pDst, pSrc1, pSrc2);
	if (i != GM_SUCCESS) {
		_MacErr(i);
		_MacRet(GM_NULL);
	}

	_MacRet(pDst);

}