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
		
			
				
	
	
		
			55 lines
		
	
	
		
			906 B
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			906 B
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /* DEC	*MakeDecimalFromLong( x, l, n)
 | |
|  *
 | |
|  * ARGUMENT
 | |
|  *	DEC	*x;
 | |
|  *	long	l;
 | |
|  *	int	n;
 | |
|  *
 | |
|  * DESCRIPTION
 | |
|  *	Converts a long	to a DEC with implied decimal 'n'. For example,
 | |
|  *  if long = 2345 and n=2, then DEC will have a value = 23.45.
 | |
|  *
 | |
|  * SIDE	EFFECTS
 | |
|  *	None.
 | |
|  *
 | |
|  * RETURNS
 | |
|  *	The DEC	if the conversion is successful, and GM_NULL otherwise.
 | |
|  *
 | |
|  * POSSIBLE ERROR CODES
 | |
|  *
 | |
|  *	GM_INVALIDID
 | |
|  *
 | |
|  * AUTHOR
 | |
|  *   Jared Levy		Feb. 9,	1987
 | |
|  *   Copyright (C) 1987-1990 Greenleaf Software	Inc.  All rights reserved.
 | |
|  *
 | |
|  * MODIFICATIONS
 | |
|  *
 | |
|  */
 | |
| 
 | |
| #include <stdio.h>
 | |
| #include "gm.h"
 | |
| #include "gmsystem.h"
 | |
| 
 | |
| DEC	*MakeDecimalFromLong( x, l, n)
 | |
| DEC	*x;
 | |
| long	l;
 | |
| int	n;
 | |
| {
 | |
| 	_MacStart(GM_MAKLD);
 | |
| 	_MacOutVarD(x);
 | |
| 
 | |
| 	if((n>GM_MAXID)||(n<GM_MINID)) {
 | |
| 		_MacErr(GM_INVALIDID);
 | |
| 		_MacRet(GM_NULL);
 | |
| 	}
 | |
| 
 | |
| 	x->ls.lattr = (l<0) ? 1	: 0;
 | |
| 	x->ls.lid =  n;
 | |
| 	x->ls.lsl[0] = (l<0) ? -l : l;
 | |
| 	x->ls.lsl[1] = 0;
 | |
| 	x->dc.msd = 0;
 | |
| 
 | |
| 	_MacRet(x);
 | |
| }
 |