campo-sirio/gfm/dmant.c

70 lines
1.0 KiB
C
Raw Normal View History

/* 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);}
}