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
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /* int	_ScaleDec80Bit(pDst,pSrc1,wID)
 | |
|  *
 | |
|  * ARGUMENT
 | |
|  *	pDst is	a pointer to the destination DEC structure.
 | |
|  *	pSrc1 is a ptr to the source1 DEC structure.
 | |
|  *	wID is the integer specifying location of implied decimal
 | |
|  *		for the	conversion.
 | |
|  *
 | |
|  * DESCRIPTION
 | |
|  *	Adjusts	the number in pSrc1 (if	necessary) while copying it to
 | |
|  *   pDst adjusting pDst to wID	number of decimal places. If pDst is null
 | |
|  *   on	entry, tries to	first create a pDst, then the conversion.
 | |
|  *
 | |
|  * SIDE	EFFECTS
 | |
|  *	pSrc1 remains unchanged, pDst is undefined on error.
 | |
|  *
 | |
|  * RETURNS
 | |
|  *	Returns	GM_SUCCESS unless there	is an error,
 | |
|  *   in	which case it returns the error	code.
 | |
|  *
 | |
|  *
 | |
|  * AUTHOR
 | |
|  *  Andy Anderson   27-JAN-1987	 19:25
 | |
|  *   Copyright (C) 1988-1990 Greenleaf Software	Inc.  All rights reserved.
 | |
|  *
 | |
|  * MODIFICATIONS
 | |
|  *
 | |
|  */
 | |
| 
 | |
| #include <stdio.h>
 | |
| #include "gm.h"
 | |
| #include "gmsystem.h"
 | |
| 
 | |
| int	_ScaleDec80Bit(pDst,pSrc1,wID)
 | |
| DEC	*pDst, *pSrc1;
 | |
| int	wID;
 | |
| {
 | |
| 	register int	i;
 | |
| 
 | |
| 	_MacDCopy(pDst,pSrc1);
 | |
| 
 | |
| 	i = pSrc1->ls.lid - wID;
 | |
| 
 | |
| 	/*  Make sure there's an adjustment to do */
 | |
| 	if(i ==	0)  {
 | |
| 		return(GM_SUCCESS);
 | |
| 		}
 | |
| 
 | |
| 	/* set implied decimal */
 | |
| 	pDst->ls.lid = wID;
 | |
| 	if(i>0)	{
 | |
| 		_DivUnsArrByPwrOf10( pDst->dc.sl,5,i);
 | |
| 		}
 | |
| 	else  {
 | |
| 		if((_MulUnsArrByPwrOf10( pDst->dc.sl, -i, 5)
 | |
| 			!= GM_SUCCESS) || (pDst->dc.msd	& 0x8000))
 | |
| 			return(GM_OVERFLOW);
 | |
| 	}
 | |
| 
 | |
| 	return(GM_SUCCESS);
 | |
| }
 |