/* DEC	*PredictX(pDst,	pSrc)
 *
 * ARGUMENT
 *	DEC	*pDst, *pSrc;
 *
 * DESCRIPTION
 *	Using the previous values of A & B of the least	squares	line
 *   Y = A + B * X, calculates the predicted value of X	corresponding to
 *   a given value of Y.  pSrc contains	Y, and the predicted X is returned
 *   to	pDst.  The globals pGMStatA and	pGMStatB should	already	contain
 *   the values	of A and B as computed and stored by LinearEstimate.
 *	X = (Y - A) / B
 *
 * SIDE	EFFECTS
 *	None.
 *
 * RETURNS
 *	pDst if	successful, otherwise GM_NULL.
 *
 * POSSIBLE ERRORS
 *	GM_NULLPOINTER
 *	GM_OVERFLOW
 *	GM_UNDERFLOW
 *	GM_DIV0
 *
 * AUTHOR
 *  Jared Levy
 *   Copyright (C) 1987-1990 Greenleaf Software	Inc.  All rights reserved.
 *
 * MODIFICATIONS
 *
 *
 */

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

DEC	*PredictX(pDst,	pSrc)
DEC	*pDst, *pSrc;
{
	DEC	dTemp, *pTemp=&dTemp;
	_MacStart(GM_PREDX);

	_MacInVarD(pSrc);
	_MacOutVarD(pDst);

	(void) _SubDec80Bit(pTemp, pSrc, pGMStatA);
	pDst = DivideDecimal(pDst, pTemp, pGMStatB);

	_MacRet(pDst);
}