campo-sirio/gfm/deltrz.c

56 lines
885 B
C
Raw Normal View History

/* DEC *DeleteTrailingZeroes(pDst, pSrc)
*
* ARGUMENT
* DEC *pSrc;
* DEC *pDst;
*
* DESCRIPTION
* Changes the interal representation of pSrc without changing its value
* by removing any trailing zeroes, if possible, and storing the result in
* pDst.
*
* SIDE EFFECTS
* None.
*
* RETURNS
* None.
*
* AUTHOR
* Jared Levy
* Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved.
*
* MODIFICATIONS
*
*/
#include <stdio.h>
#include "gm.h"
#include "gmsystem.h"
DEC *DeleteTrailingZeroes(pDst, pSrc)
DEC *pSrc;
DEC *pDst;
{
DEC dTemp, *pTemp=&dTemp;
unsigned i=0;
_MacStart(GM_DELTRZ);
_MacInVarD(pSrc);
_MacOutVarD(pDst);
_MacDCopy(pTemp, pSrc);
while ((i==0) && (pTemp->dc.id>0)) {
_MacDCopy(pDst, pTemp);
i = _DivUnsArrByUns(pTemp->dc.sl, 10, 5);
pTemp->dc.id--;
}
if (i==0)
_MacDCopy(pDst,pTemp);
_MacRet(pDst);
}