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
		
			
				
	
	
		
			77 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
/* int	CompareDecimal(pSrc1,pSrc2)
 | 
						|
 *
 | 
						|
 * ARGUMENT
 | 
						|
 *	pSrc1 is a ptr to the source1 DEC structure.
 | 
						|
 *	pSrc2 is a ptr to the source2 DEC structure.
 | 
						|
 *
 | 
						|
 * DESCRIPTION
 | 
						|
 *	Compares pSrc1:pSrc2 and returns the result of the compare.
 | 
						|
 *
 | 
						|
 * SIDE	EFFECTS
 | 
						|
 *	None.
 | 
						|
 *
 | 
						|
 * RETURNS
 | 
						|
 *	Returns	0 if pSrc1==pSrc2, 1 if	pSrc1>pSrc2 and	-1 if pSrc2>pSrc1.
 | 
						|
 *   However, returns GM_NULLPOINTER if	pSrc1 or pSrc2 point to	a null.
 | 
						|
 *
 | 
						|
 *
 | 
						|
 * POSSIBLE ERROR CODES
 | 
						|
 *
 | 
						|
 *	GM_NULLPOINTER
 | 
						|
 *
 | 
						|
 * AUTHOR
 | 
						|
 *  Andy Anderson   14-JAN-1987	 14:27
 | 
						|
 *   Copyright (C) 1987-1990 Greenleaf Software	Inc.  All rights reserved.
 | 
						|
 *
 | 
						|
 * MODIFICATIONS
 | 
						|
 *
 | 
						|
 */
 | 
						|
 | 
						|
#include <stdio.h>
 | 
						|
#include "gm.h"
 | 
						|
#include "gmsystem.h"
 | 
						|
 | 
						|
int	CompareDecimal(pSrc1,pSrc2)
 | 
						|
DEC	*pSrc1,*pSrc2;
 | 
						|
{
 | 
						|
	int	i;
 | 
						|
	DEC	dt,*pt=&dt;
 | 
						|
 | 
						|
	_MacStart(GM_DCMP);
 | 
						|
 | 
						|
	_MacInVarI(pSrc1);
 | 
						|
	_MacInVarI(pSrc2);
 | 
						|
 | 
						|
	if (_MacIsDecZ(pSrc2))
 | 
						|
		_MacRet(TestSignDecimal(pSrc1));
 | 
						|
 | 
						|
	if (_MacIsDecZ(pSrc1))
 | 
						|
		_MacRet(-TestSignDecimal(pSrc2));
 | 
						|
 | 
						|
	if (_MacIsDecN(pSrc1)^_MacIsDecN(pSrc2))
 | 
						|
		_MacRet(_MacIsDecP(pSrc1) ? 1 :	-1);
 | 
						|
 | 
						|
	if (pSrc1->dc.id == pSrc2->dc.id)  {
 | 
						|
		i=_CompareUnsArr( pSrc1->dc.sl,
 | 
						|
			 pSrc2->dc.sl,5);
 | 
						|
		_MacRet(_MacIsDecP(pSrc1) ? i :	-i);
 | 
						|
		}
 | 
						|
 | 
						|
	if (pSrc1->dc.id > pSrc2->dc.id)  {
 | 
						|
		i= _ScaleDec80Bit(&dt, pSrc2, pSrc1->dc.id);
 | 
						|
		if (i != GM_SUCCESS)
 | 
						|
			_MacRet(-TestSignDecimal(pSrc2));
 | 
						|
		i=_CompareUnsArr( pSrc1->dc.sl,
 | 
						|
			 pt->dc.sl,5);
 | 
						|
		_MacRet(_MacIsDecP(pSrc1) ? i :	-i);
 | 
						|
		}
 | 
						|
 | 
						|
	/* pSrc1->dc.id	< pSrc2->dc.id */
 | 
						|
		i= _ScaleDec80Bit(&dt, pSrc1, pSrc2->dc.id);
 | 
						|
		if (i != GM_SUCCESS)
 | 
						|
			_MacRet(TestSignDecimal(pSrc1));
 | 
						|
		i=_CompareUnsArr( pt->dc.sl,
 | 
						|
			 pSrc2->dc.sl,5);
 | 
						|
		_MacRet(_MacIsDecP(pSrc2) ? i :	-i);
 | 
						|
}
 |