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
		
			
				
	
	
		
			78 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /* DEC	*AntiLogEDecimal(pDst,pSrc)
 | |
|  *
 | |
|  * ARGUMENT
 | |
|  *	DEC	*pDst;
 | |
|  *	DEC	*pSrc;
 | |
|  *
 | |
|  * DESCRIPTION
 | |
|  *	Sets pDst = e^pSrc;
 | |
|  *
 | |
|  * SIDE	EFFECTS
 | |
|  *	None.
 | |
|  *
 | |
|  * RETURNS
 | |
|  *	Returns	pointer	to pDst	if successful, otherwise a GM_NULL. The
 | |
|  *   type error	(GM_OVERFLOW, GM_UNDERFLOW, GM_NOMEMORY) is in wGMError
 | |
|  *   if	wGMError didn't	contain	a previous error on entry.
 | |
|  *
 | |
|  * POSSIBLE ERROR CODES
 | |
|  *
 | |
|  *	GM_NULLPOINTER
 | |
|  *	GM_OVERFLOW
 | |
|  *	GM_UNDERFLOW
 | |
|  *
 | |
|  * AUTHOR
 | |
|  *  Jared Levy		Aug 7, 1987
 | |
|  *   Copyright (C) 1987-1990 Greenleaf Software	Inc.  All rights reserved.
 | |
|  *
 | |
|  * MODIFICATIONS
 | |
|  *
 | |
|  */
 | |
| 
 | |
| #include <stdio.h>
 | |
| #include "gm.h"
 | |
| #include "gmsystem.h"
 | |
| 
 | |
| DEC	*AntiLogEDecimal(pDst,pSrc)
 | |
| DEC	*pDst;
 | |
| DEC	*pSrc;
 | |
| {
 | |
| 	int	i;
 | |
| 	DEC	*pa;
 | |
| 
 | |
| 	_MacStart(GM_DEXP);
 | |
| 	_MacInVarD(pSrc);
 | |
| 	_MacOutVarD(pDst);
 | |
| 
 | |
| 	if((pSrc->dc.id	== 0) && ((pSrc->dc.msd	== 0) &&
 | |
| 		(pSrc->ls.lsl[1] == 0L)	&& (pSrc->dc.sl[1] == 0))
 | |
| 		&& (!(pSrc->dc.sl[0] & 0x8000))) {
 | |
| 		pa = &decE;	/* points to constant 'e' */
 | |
| 		_MacDCopy(pDst,pa);
 | |
| 		i = _IntPwrDec80Bit(pDst,pDst,ConvDecimalToInt(pSrc));
 | |
| 		if(i !=	GM_SUCCESS) {
 | |
| 			_MacErr(i);
 | |
| 			_MacRet(GM_NULL);
 | |
| 		}
 | |
| 	}
 | |
| 	else {
 | |
| 		i = _ExpDec80Bit(pDst, pSrc);
 | |
| 		if (i == GM_OVERFLOW)  {
 | |
| 			_MacErr(i);
 | |
| 			_MacRet(GM_NULL);
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	/* reduce from 80-bit back to 64-bit */
 | |
| 	if(_Sq5UnsTo4Uns(pDst) != GM_SUCCESS) {
 | |
| 		_MacErr(GM_OVERFLOW);
 | |
| 		_MacRet(GM_NULL);
 | |
| 	}
 | |
| 
 | |
| 	if (_MacIsDecZ(pDst)) {
 | |
| 		_MacErr(GM_UNDERFLOW);
 | |
| 	}
 | |
| 
 | |
| 	_MacRet(pDst);
 | |
| }
 |