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
66 lines
1.2 KiB
C
Executable File
66 lines
1.2 KiB
C
Executable File
/* DEC *LogEDecimal(pDst,pSrc)
|
|
* ARGUMENT
|
|
* pDst is a DEC pointer to the destination.
|
|
* pSrc is a DEC pointer to the source.
|
|
*
|
|
* DESCRIPTION
|
|
* Takes the natural logarithm of pSrc, storing result in pDst.
|
|
*
|
|
* SIDE EFFECTS
|
|
* pDst is indeterminate on error.
|
|
* Possible errors:
|
|
* GM_NULLPOINTER
|
|
* GM_IMAG if pSrc <= 0
|
|
* Note: overflow and underflow are not possible.
|
|
*
|
|
* RETURNS
|
|
* pDst if successful, GM_NULL otherwise.
|
|
*
|
|
* ALGORTIHM
|
|
* pSrc = 10^m * 2^(-d) * x .7 <= x < 1.4
|
|
* z = (x - 1) / (x + 1)
|
|
* ln pSrc = m * ln 10 - d * ln 2 + ln x
|
|
* ln x = 2 * SUM [z^(2 * n + 1) / (2 * n + 1)]
|
|
* n = 0, 1, 2, 3,...
|
|
*
|
|
* POSSIBLE ERROR CODES
|
|
*
|
|
* GM_NULLPOINTER
|
|
* GM_NOMEMORY
|
|
* GM_IMAG
|
|
*
|
|
* AUTHOR
|
|
* Jared Levy 4 / 8 / 1987
|
|
* Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved.
|
|
*
|
|
* MODIFICATIONS
|
|
*
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include "gm.h"
|
|
#include "gmsystem.h"
|
|
|
|
DEC *LogEDecimal(pDst,pSrc)
|
|
DEC *pDst;
|
|
DEC *pSrc;
|
|
{
|
|
int i;
|
|
|
|
_MacStart(GM_DLN);
|
|
|
|
_MacInVar(pSrc,GM_NULL);
|
|
_MacOutVar(pDst,GM_NULL);
|
|
|
|
i = _LnDec80Bit(pDst, pSrc);
|
|
if (i != GM_SUCCESS) {
|
|
_MacErr(i);
|
|
_MacRet(GM_NULL);
|
|
}
|
|
|
|
/* following cannot be unsuccessful */
|
|
(void) _Sq5UnsTo4Uns(pDst);
|
|
|
|
_MacRet(pDst);
|
|
}
|