/* DEC *PercentOf(pDst,pSrc1,pSrc2) * * ARGUMENT * DEC *pDst, *pSrc1, pSrc2; * * DESCRIPTION * Calculates the percent pSrc2 is of pSrc1, stroring the result in pDst. * pDst = (pSrc2 / pSrc1) * 100 * pDst is calculated to maximum precision. * * SIDE EFFECTS * None. * * RETURNS * Returns a pointer to the dest structure unless overflow, * when it returns a GM_NULL. * * POSSIBLE ERROR CODES * * GM_NULLPOINTER * GM_NOMEMORY * GM_OVERFLOW * GM_UNDERFLOW * GM_DIV0 * * AUTHOR * Jared Levy * Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved. * * MODIFICATIONS * */ #include #include "gm.h" #include "gmsystem.h" DEC *PercentOf(pDst,pSrc1,pSrc2) DEC *pDst; DEC *pSrc1,*pSrc2; { DEC dtemp, *temp=&dtemp; _MacStart(GM_POF); _MacDCopy(temp, pSrc1); pDst = DivideDecimal(pDst, temp, pSrc2); pDst->dc.id -= 2; _MacRet(pDst); /* error flag set by DivideDecimal */ }