/* Include this only when compiling MathLib source code. * * Greenleaf Financial Mathlib * * Contains definitions and prototypes used by internal routines. * Copyright (C)1987-1990 Greenleaf Software Inc. All rights reserved. */ #ifndef GMDOTH #include #endif #define GM_IMAXID 23 /* values for intermediate calcs. */ #define GM_IMINID 0 /* then define the global constants that are in gmglobal.c */ extern int _wGMUser; extern unsigned SHORT wrgGMPowersOfTen80Bit[]; extern double ergGMPowersOfTenDouble[]; extern double eTwoTo31; extern double eTwoTo32; extern double eTwoTo63; extern double eTwoTo64; extern DEC decPoint7; extern DEC decOne; extern DEC decOnePoint4; extern DEC decReciprocalOfLn2; extern DEC decReciprocalOfLn10; extern DEC decLn2; extern DEC decLn10; extern DEC decE; /* Naperian base(2.71828...) */ extern DEC decMaxExp; /* max exponent for e**x in DEC */ extern DEC decMinExp; /* min exponent for e**x in DEC */ extern DEC decPoint259; /* next 5 used for square root */ extern DEC decTwoPoint59; /* 2.59 */ extern DEC decPoint819; /* 0.819 */ extern DEC decPoint0819; /* 0.0819 */ extern DEC decPoint5; /* 0.5 */ extern DEC decPi; /* next 6 used for trig */ extern DEC decPiOver2; extern DEC decPiOver4; extern DEC decPiOver6; extern DEC dec2Pi; extern DEC decReciprocalOfSqrt3; extern DEC dec180OverPi; extern DEC decPiOver180; extern DEC decMaxLinEst; /* next 2 used in linear estimation */ extern DEC decMinLinEst; extern DEC decMaxTime; /* maximum time for business */ extern DEC decMinusHundred; extern DEC decHundred; extern DEC decMinus50; extern DEC decOnePoint6; extern DEC decPoint01; #ifdef __cplusplus extern "C" { #endif //#ifdef M_I386 //#define SHORT short //#else //#define SHORT int //#endif int _AddDec80Bit( DEC *, DEC *, DEC *); int GF_CDECL _AddUnsArrToUnsArr( unsigned SHORT [], unsigned SHORT [], unsigned SHORT [], int ); void _ATanDec80Bit( DEC *, DEC *); int GF_CDECL _CompareUnsArr( unsigned SHORT [], unsigned SHORT [], int ); DEC * _CompoundAux( int , int *, DEC *, DEC *, DEC *, DEC *, DEC *, int , int ); void _ConvDecimalToAsciiFormatted( char *, DEC *, char *); void _CosDec80Bit( DEC *, DEC *); void _CosDecSmall( DEC *, DEC *); int _DivDec80Bit( DEC *, DEC *, DEC *); int _DivDecFast( DEC *, DEC *, DEC *); int _DivProcFast( DEC *, DEC *, DEC *); int _DivProcRnd( DEC *, unsigned SHORT [], unsigned SHORT [], int , int , int ); int _DivProcTrn( DEC *, unsigned SHORT [], unsigned SHORT [], int , int , int ); int _DivRndDec80Bit( DEC *, DEC *, DEC *, int ); int _DivTrnDec80Bit( DEC *, DEC *, DEC *, int ); void _DivUns10ArrByUns5Arr( unsigned SHORT [], unsigned SHORT [], unsigned SHORT [] ); void _DivUns10ArrByUns5ArrTrn( unsigned SHORT [], unsigned SHORT [], unsigned SHORT [] ); void GF_CDECL _DivUnsArrByPwrOf10( unsigned SHORT [], int , int ); void GF_CDECL _DivUnsArrByPwrOf10Trunc( unsigned SHORT [], int , int ); unsigned GF_CDECL _DivUnsArrByUns( unsigned SHORT [], unsigned SHORT , int ); void GF_CDECL _DivUnsArrByUnsArr( unsigned SHORT [], unsigned SHORT [], int , unsigned SHORT [], int , int ); void GF_CDECL _DivUnsArrByUnsRound( unsigned SHORT [], unsigned SHORT , int ); unsigned GF_CDECL _DoubleUnsArr( unsigned SHORT [], int ); int _ExpDec80Bit( DEC *, DEC *); void GF_CDECL _HalveUnsArr( unsigned SHORT [], int ); void GF_CDECL _IncrementUnsArr( unsigned SHORT [] ); int _IntPwrDec80Bit( DEC *, DEC *, int ); DEC * _InterestAux( int , int , DEC * , DEC * , DEC *, DEC *, DEC *, int ); int _LnDec80Bit( DEC *, DEC *); int _MulDec80Bit( DEC *, DEC *, DEC *); void GF_CDECL _MulUnsArr( unsigned SHORT [], unsigned SHORT [], unsigned SHORT, int); int GF_CDECL _MulUnsArrByPwrOf10( unsigned SHORT [], int , int ); int GF_CDECL _MulUnsArrByPwrOf10Limited( unsigned SHORT [], int , int ); void GF_CDECL _MulUnsArrByUnsArr( unsigned SHORT [], unsigned SHORT [], unsigned SHORT [], int , int , int ); int GF_CDECL _MulUnsArrP10AndAddInt( unsigned SHORT [], int ); int _ScaleDec80Bit( DEC *, DEC *, int ); int _ScanfAux( int , char *, char *, ELLIPSES); DEC * _SimpleAux( int *, DEC *, DEC *, DEC *, int , int ); void _SinDecSmall( DEC *, DEC *); int _SortDec( DEC **, DEC **); int _SortInc( DEC **, DEC **); int _Sq5UnsTo4Uns( DEC *); void _SqrtDec80Bit( DEC *, DEC *); int _SubDec80Bit(DEC *, DEC *, DEC *); void GF_CDECL _SubUnsArr( unsigned SHORT [], unsigned SHORT [], int ); int GF_CDECL _SubUnsArrFromUnsArr( unsigned SHORT [], unsigned SHORT [], unsigned SHORT [], int ); int _TruncateDec80Bit( DEC *, DEC *, int ); #ifdef __cplusplus } #endif /*****/ #define _MacDZero(a) { (a)->dc.attr=0; (a)->dc.id=2; (a)->dc.sl[0]=0; (a)->dc.sl[1]=0; (a)->dc.sl[2]=0; (a)->dc.sl[3]=0; (a)->dc.msd=0; } #define _MacIsDecZ(a) ((((a)->ls.lsl[0])|((a)->ls.lsl[1])|((a)->dc.msd)) ? FALSE:TRUE) #define _MacIsDecP(a) (((((a)->dc.attr&GM_NEG)^GM_NEG)&&(!_MacIsDecZ(a))) ? TRUE : FALSE) #define _MacIsDecN(a) (((a)->dc.attr&GM_NEG)&&(!_MacIsDecZ(a))) #define _MacDCopy(a,b) ((*a) = (*b)) #define _MacDChgs(a) a->dc.attr=a->dc.attr^GM_NEG; #define _MacStart(a) int _wGMCurr=(a); if (!_wGMUser) _wGMUser=(a); #define _MacRet(a) {if (_wGMUser==_wGMCurr) _wGMUser=0; return(a);} #define _MacRetV {if (_wGMUser==_wGMCurr) _wGMUser=0; return;} #define _MacErr(a) SetMathError((a),_wGMUser) #define _MacBad(a) (a->dc.iddc.id>GM_IMAXID+5) #define _MacInVar(a,b) {if (!a) {_MacErr(GM_NULLPOINTER); _MacRet(b);} else if (_MacBad(a)) {_MacErr(GM_INIT); _MacRet(b);}} #define _MacOutVar(a,b) {if (!a) {_MacErr(GM_NULLPOINTER); _MacRet(b);}} #define _MacInVarD(a) {if (!a) {_MacErr(GM_NULLPOINTER); _MacRet(GM_NULL);} else if (_MacBad(a)) {_MacErr(GM_INIT); _MacRet(GM_NULL);}} #define _MacOutVarD(a) {if (!a) {_MacErr(GM_NULLPOINTER); _MacRet(GM_NULL);}} #define _MacInVarI(a) {if (!a) {_MacErr(GM_NULLPOINTER); _MacRet(GM_NULLPOINTER);} else if (_MacBad(a)) {_MacErr(GM_INIT); _MacRet(GM_INIT);}}