mtollari 1b14ec9415 Spostamento cartella sorgenti
git-svn-id: svn://10.65.10.50/branches/R_10_00@23236 c028cbd2-c16b-5b4b-a496-9718f37d4682
2016-09-09 13:59:02 +00:00

60 lines
1.1 KiB
C
Executable File

/* DEC *AddPercent(pDst,pSrc1,pSrc2)
*
* ARGUMENT
* DEC *pDst, *pSrc1, pSrc2;
*
* DESCRIPTION
* Adds pSrc2 percent to pSrc1, stroring the result in pDst.
* pDst = pSrc1 * (1 + pSrc2/100)
* pDst is rounded two 2 decimal places.
*
* 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_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 *AddPercent(pDst,pSrc1,pSrc2)
DEC *pDst;
DEC *pSrc1,*pSrc2;
{
DEC dtemp, *temp=&dtemp;
_MacStart(GM_PADD);
_MacInVarD(pSrc2);
_MacDCopy(temp, pSrc2);
temp->dc.id += 2;
(void) _AddDec80Bit(temp, temp, &decOne);
/* overflow not possible */
if (_Sq5UnsTo4Uns(temp)!=GM_SUCCESS) {
_MacErr(GM_ARGVAL);
_MacRet(GM_NULL);
}
pDst = MultiplyDecimalAndRound(pDst, pSrc1, temp, 2);
_MacRet(pDst);
/* error flag set by MultiplyDecimalAndRound */
}