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
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /* int	_DivDecFast(pDst,pSrc1,pSrc2);
 | |
|  *
 | |
|  * ARGUMENT
 | |
|  *	DEC	*pDst;
 | |
|  *	DEC	*pSrc1,pSrc2;
 | |
|  *
 | |
|  * DESCRIPTION
 | |
|  *	Divides	pDst = pSrc1 / pSrc2, to 64 bits of accuracy.
 | |
|  *	This code is about 1/3 faster than ddix.
 | |
|  *
 | |
|  * SIDE	EFFECTS
 | |
|  *	None.
 | |
|  *
 | |
|  * RETURNS
 | |
|  *	Returns	GM_SUCCESS if successful, otherwise the	error code.
 | |
|  *	wGMError is not	changed.
 | |
|  *
 | |
|  * AUTHOR
 | |
|  *  Jared Levy	 05-JAN-1987  17:30
 | |
|  *   Copyright (C) 1987-1990 Greenleaf Software	Inc.  All rights reserved.
 | |
|  *
 | |
|  * MODIFICATIONS
 | |
|  *
 | |
|  */
 | |
| 
 | |
| #include <stdio.h>
 | |
| #include "gm.h"
 | |
| #include "gmsystem.h"
 | |
| int	_DivProcFast();
 | |
| 
 | |
| int	_DivDecFast(pDst,pSrc1,pSrc2)
 | |
| DEC	*pDst;
 | |
| DEC	*pSrc1,*pSrc2;
 | |
| {
 | |
| 
 | |
| 	/*  check that pSrc2 is	nonzero	*/
 | |
| 	if (_MacIsDecZ(pSrc2))
 | |
| 		return(GM_DIV0);
 | |
| 
 | |
| 	/*  check whether scr1 is zero */
 | |
| 	if (_MacIsDecZ(pSrc1))	{
 | |
| 		_MacDCopy(pDst,	pSrc1);
 | |
| 		return(GM_SUCCESS);
 | |
| 	}
 | |
| 
 | |
| 	if (_DivProcFast(pDst,pSrc1,pSrc2) != GM_SUCCESS)
 | |
| 		return(GM_OVERFLOW);
 | |
| 
 | |
| 	/* if quotient is zero,	an underflow has occured */
 | |
| 	if (_MacIsDecZ(pDst))
 | |
| 		return(GM_UNDERFLOW);
 | |
| 
 | |
| /*  if the signs of the	sources	are different, pDst=-pDst */
 | |
| 	pDst->dc.attr=pSrc1->dc.attr^pSrc2->dc.attr;
 | |
| 
 | |
| 	return(GM_SUCCESS);
 | |
| }
 |