/* gmglobal.c * * ARGUMENT * None. * * DESCRIPTION * Global variable definitions for the math lib. * * SIDE EFFECTS * None. * * RETURNS * None. * * AUTHOR * Andy Anderson 13-JAN-1987 18:35 * Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved. * * MODIFICATIONS * Don Killen - 10-19-1989 18:22:09 Added Imbedded Copyright Notice. */ #include #include "gm.h" #include "gmsystem.h" /* place for error return values */ int wGMError=GM_SUCCESS; /* function # that caused error */ int wGMFunErrNum=0; /* default error function handler */ void (*pfnGMErrVector)(int,int) = GMDefErrHandler; /* global storage for internal use */ int _wGMUser=0; /* function called by user */ int wGMTemp1=0; int wGMTemp2=0; mbool wfGMRound=TRUE; /* next 30 used for formatted conversions */ mbool wfFlagNumber=FALSE; char cGMSymExp='e'; int wGMStar=2; /* storage of * arguments for dtoaf */ int wGMStar2=2; char cGMFmt='t'; /* next 20 format string types */ char cGMFmtComma='v'; char cGMFmtSci='w'; char cGMFmtSciE='W'; char cGMFmtEng='z'; char cGMFmtEngE='Z'; char cGMFmtRnd='R'; char cGMFmtTrunc='T'; char cGMFmtDlr='$'; char cGMFmtNegRgt1='m'; char cGMFmtNegRgt2='M'; char cGMFmtNegPar='a'; char cGMFmtNegBrkt='A'; char cGMFmtZeroBlC='q'; char cGMFmtZeroBlS='Q'; char cGMFmtZero=' '; char *sGMFmtZeroStr="None"; char cGMFmtSurrL='['; char cGMFmtSurrR=']'; char *sGMFmt1Pos =" (cr)"; char *sGMFmt1Neg =" (dr)"; char *sGMFmt1Zero=" "; char *sGMFmt2Pos =" (dr)"; char *sGMFmt2Neg =" (cr)"; char *sGMFmt2Zero=" "; mbool wfGM3Color=FALSE; /* next 4 used in 3-color printing */ char cGMCodePos=0x24; char cGMCodeNeg=0x25; char cGMCodeNon=0x26; int wIntrPrec=18; /* next used to hold 160-bit partial products */ int wrgGMPartProd[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* A Powers of ten table (25 entries in 80-bit format) */ unsigned SHORT wrgGMPowersOfTen80Bit[]={0x0001,0x0000,0x0000,0x0000,0x0000, 0x000a,0x0000,0x0000,0x0000,0x0000, 0x0064,0x0000,0x0000,0x0000,0x0000, 0x03e8,0x0000,0x0000,0x0000,0x0000, 0x2710,0x0000,0x0000,0x0000,0x0000, 0x86a0,0x0001,0x0000,0x0000,0x0000, 0x4240,0x000f,0x0000,0x0000,0x0000, 0x9680,0x0098,0x0000,0x0000,0x0000, 0xe100,0x05f5,0x0000,0x0000,0x0000, 0xca00,0x3b9a,0x0000,0x0000,0x0000, 0xe400,0x540b,0x0002,0x0000,0x0000, 0xe800,0x4876,0x0017,0x0000,0x0000, 0x1000,0xd4a5,0x00e8,0x0000,0x0000, 0xa000,0x4e72,0x0918,0x0000,0x0000, 0x4000,0x107a,0x5af3,0x0000,0x0000, 0x8000,0xa4c6,0x8d7e,0x0003,0x0000, 0x0000,0x6fc1,0x86f2,0x0023,0x0000, 0x0000,0x5d8a,0x4578,0x0163,0x0000, 0x0000,0xa764,0xb6b3,0x0de0,0x0000, 0x0000,0x89e8,0x2304,0x8ac7,0x0000, 0x0000,0x6310,0x5e2d,0x6bc7,0x0005, 0x0000,0xdea0,0xadc5,0x35c9,0x0036, 0x0000,0xb240,0xc9ba,0x19e0,0x021e, 0x0000,0xf680,0xe14a,0x02c7,0x152d}; char _crn_[]={0x43,0x6f,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43, 0x29,0x31,0x39,0x38,0x37,0x2d,0x38,0x39,0x20,0x47,0x72,0x65,0x65,0x6e, 0x6c,0x65,0x61,0x66,0x20,0x53,0x6f,0x66,0x74,0x77,0x61,0x72,0x65,0x20, 0x49,0x6e,0x63,0x2e,0x20,0x41,0x6c,0x6c,0x20,0x52,0x69,0x67,0x68,0x74, 0x73,0x20,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2e}; /* Powers of ten table in double format for internal use */ double ergGMPowersOfTenDouble[25]={1.0,1e1,1e2,1e3,1e4,1e5,1e6,1e7, 1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17,1e18,1e19,1e20, 1e21,1e22,1e23,1e24}; double eTwoTo31= 2147483647.0; /* 2**31 */ double eTwoTo32= 4294967296.0; /* 2**32 */ double eTwoTo63= 9223372036854775808.0; /* 2**63 */ double eTwoTo64=18446744073709551616.0; /* 2**64 */ /* 0.7 */ DEC decPoint7={0,1,{0x0007,0,0,0},0}; /* Decimal One */ DEC decOne={0,0,{1,0,0,0},0}; /* 1.4 */ DEC decOnePoint4={0,1,{0x000e,0,0,0},0}; /* 'e' */ DEC decE={0,23,{0xa69c,0xb692,0x7ae9,0xd5d7,},0x398f}; DEC decReciprocalOfLn2={0,23,{0xb7f8,0x4faf,0x9c42,0xdd90},0x1e8c}; DEC decReciprocalOfLn10={0,23,{0x1839,0xcbbd,0xa605,0x50aa},0x0932}; DEC decLn2={0,23,{0x4b1b,0xb4a3,0xfacf,0x8ef2},0x0ead}; DEC decLn10={0,23,{0x1787,0xe426,0xa5f0,0x56bb},0x30c2}; /* maximum exponent for e**x is e**43=4.7279394...E+18 */ DEC decMaxExp={0,0,{43,0,0,0},0}; /* minimum exponent for e**x is e**-42=1.5628821...E-18 */ DEC decMinExp={1,0,{42,0,0,0},0}; /* constants used in square root */ DEC decPoint819={0,3,{819,0,0,0},0}; DEC decPoint259={0,3,{259,0,0,0},0}; DEC decTwoPoint59={0,2,{259,0,0,0},0}; DEC decPoint0819={0,4,{819,0,0,0},0}; DEC decPoint5={0,1,{5,0,0,0},0}; /* constants used in trig */ DEC decPi={0,23,{0xde78,0xfbea,0x5cdd,0x9b9f},0x4286}; DEC decPiOver2={0,23,{0x6f3c,0xfdf5,0xae6e,0x4dcf},0x2143}; DEC decPiOver4={0,23,{0xb79e,0x7efa,0xd737,0xa6e7},0x10a1}; DEC dec2Pi={0,22,{0x92e5,0x98c8,0xdf5f,0x1f1f},0x0d4e}; DEC decPiOver6={0,23,{0xcfbf,0xff51,0x3a24,0x6f45},0x0b16}; DEC decReciprocalOfSqrt3={0,23,{0x6563,0x8bd3,0xe183,0xd273},0x0c39}; DEC dec180OverPi={0,22,{0x91ee,0x89a6,0x22fb,0x1ab4},0x7954}; DEC decPiOver180={0,23,{0x75dc,0xc43e,0x1b89,0x9d4f},0x005e}; /* statistical globals for linear estimation */ DEC decMaxLinEst={0,0,{0x4240,0x000f,0,0},0}; DEC decMinLinEst={1,0,{0x4240,0x000f,0,0},0}; DEC decMaxTime={0,0,{1000,0,0,0},0}; DEC decMinusHundred={1,0,{100,0,0,0},0}; DEC decHundred={0,0,{100,0,0,0},0}; DEC decMinus50={1,0,{50,0,0,0},0}; DEC decOnePoint6={0,1,{16,0,0,0},0}; DEC decGMIRRGuess={0,0,{2,0,0,0},0}; DEC *pGMIRRGuess=&decGMIRRGuess; DEC decPoint01={0,2,{1,0,0,0},0}; DEC decStatA={0,0,{0,0,0,0},0}; DEC decStatB={0,0,{1,0,0,0},0}; DEC *pGMStatA = &decStatA; DEC *pGMStatB = &decStatB;