campo-sirio/gfm/dsqrt.c
alex ba237a9d91 Patch level : no patch
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
2002-02-26 12:19:02 +00:00

54 lines
848 B
C
Executable File

/* DEC *SquareRootDecimal(pDst,pSrc1)
*
* ARGUMENT
* DEC *pDst;
* DEC *pSrc1;
*
* DESCRIPTION
* Sets pDst = square root of pSrc1.
*
* SIDE EFFECTS
*
* RETURNS
* Returns pointer to pDst if successful, otherwise a GM_NULL.
*
* POSSIBLE ERROR CODES
*
* GM_NULLPOINTER
* GM_IMAG
*
* 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 *SquareRootDecimal(pDst,pSrc1)
DEC *pDst;
DEC *pSrc1;
{
_MacStart(GM_DSQRT);
_MacInVarD(pSrc1);
_MacOutVarD(pDst);
if (_MacIsDecN(pSrc1)) {
_MacErr(GM_IMAG);
_MacRet(GM_NULL);
}
/* no errors possible if pSrc1 >= 0 */
_SqrtDec80Bit(pDst, pSrc1);
/* reduce from 80-bit back to 64-bit */
(void) _Sq5UnsTo4Uns(pDst);
_MacRet(pDst);
}