campo-sirio/gfm/predy.c
alex ba237a9d91 Patch level : no patch
Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Aggiunti i sorgenti per Greenleaf Math Library (gfm.dll)


git-svn-id: svn://10.65.10.50/trunk@10079 c028cbd2-c16b-5b4b-a496-9718f37d4682
2002-02-26 12:19:02 +00:00

52 lines
1.0 KiB
C
Executable File

/* DEC *PredictY(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 Y corresponding to
* a given value of X. pSrc contains X, and the predicted Y is returned
* to pDst. The globals pGMStatA and pGMStatB should already contain
* the values of A and B as computed and stored by LinearEstimate.
*
* SIDE EFFECTS
* None.
*
* RETURNS
* pDst if successful, otherwise GM_NULL.
*
* POSSIBLE ERRORS
* GM_NULLPOINTER
* GM_OVERFLOW
* GM_UNDERFLOW
*
* AUTHOR
* Jared Levy
* Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved.
*
* MODIFICATIONS
*
*
*/
#include <stdio.h>
#include "gm.h"
#include "gmsystem.h"
DEC *PredictY(pDst, pSrc)
DEC *pDst, *pSrc;
{
DEC dTemp, *pTemp=&dTemp;
_MacStart(GM_PREDY);
_MacInVarD(pSrc);
_MacOutVarD(pDst);
if (!MultiplyDecimal(pTemp, pSrc, pGMStatB))
_MacRet(GM_NULL);
pDst = AddDecimal(pDst, pTemp, pGMStatA);
_MacRet(pDst);
}