campo-sirio/gfm/dmant.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

70 lines
1.0 KiB
C
Executable File

/* long DecimalMantissa(pSrc);
*
* ARGUMENT
* DEC *pSrc;
*
* DESCRIPTION
* Finds the mantissa of pSrc.
*
* SIDE EFFECTS
* None.
*
* RETURNS
* The mantissa, or an error code
*
* POSSIBLE ERROR CODES
*
* GM_NULLPOINTER
* GM_OVERFLOW
*
* AUTHOR
* Jared Levy
* Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved.
*
* MODIFICATIONS
*
*
*/
#include <stdio.h>
#include "gm.h"
#include "gmsystem.h"
long DecimalMantissa(pSrc)
DEC *pSrc;
{
long l;
_MacStart(GM_DMANT);
if (!pSrc) {
_MacErr(GM_NULLPOINTER);
_MacRet((long) GM_NULLPOINTER);
}
if (_MacBad(pSrc)) {
_MacErr(GM_INIT);
_MacRet((long) GM_INIT);
}
if (pSrc->ls.lsl[1] || pSrc->ls.lmsd) {
_MacErr(GM_OVERFLOW);
l = (long) GM_OVERFLOW;
_MacRet(l);
}
if (pSrc->ls.lsl[0]&0x80000000L) {
if ((pSrc->ls.lsl[0]!=0x80000000L) || !_MacIsDecN(pSrc)) {
_MacErr(GM_OVERFLOW);
_MacRet((long) GM_OVERFLOW);
}
else
_MacRet((long) 0x80000000L);
}
l = pSrc->ls.lsl[0];
if (_MacIsDecN(pSrc))
{_MacRet(-l);}
else
{_MacRet(l);}
}