source: buchla-68k/orig/LATTICE/MATH.H@ 7bf3856

Last change on this file since 7bf3856 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 2.5 KB
RevLine 
[3ae31e9]1/*
2 Redefine secondary simulation function names to become primary names
3 for systems without a Numeric Data Processor.
4*/
5
6#ifdef NONDP
7#define _acos acos
8#define _asin asin
9#define _atan atan
10#define _cos cos
11#define _cosh cosh
12#define _cot cot
13#define _exp exp
14#define _fabs fabs
15#define _ldexp ldexp
16#define _log log
17#define _log10 log10
18#define _modf modf
19#define _pow pow
20#define _pow2 pow2
21#define _sin sin
22#define _sinh sinh
23#define _sqrt sqrt
24#define _tan tan
25#define _tanh tanh
26#endif
27
28/* Structure to hold information about math exceptions */
29
30struct exception
31 {
32 int type; /* error type */
33 char *name; /* math function name */
34 double arg1, arg2; /* function arguments */
35 double retval; /* proposed return value */
36 };
37
38/* Exception type codes, found in exception.type */
39
40#define DOMAIN 1 /* domain error */
41#define SING 2 /* singularity */
42#define OVERFLOW 3 /* overflow */
43#define UNDERFLOW 4 /* underflow */
44#define TLOSS 5 /* total loss of significance */
45#define PLOSS 6 /* partial loss of significance */
46
47/* Error codes generated by basic arithmetic operations (+ - * /) */
48
49#define FPEUND 1 /* underflow */
50#define FPEOVF 2 /* overflow */
51#define FPEZDV 3 /* zero divisor */
52#define FPENAN 4 /* not a number (invalid operation) */
53
54/* Constants */
55
56#define PI 3.14159265358979323846
57#define PID2 1.57079632679489661923 /* PI divided by 2 */
58#define PID4 0.78539816339744830962 /* PI divided by 4 */
59#define I_PI 0.31830988618379067154 /* Inverse of PI */
60#define I_PID2 0.63661977236758134308 /* Inverse of PID2 */
61
62#define HUGE 1.797693e308 /* huge value */
63#define TINY 2.2e-308 /* tiny value */
64#define LOGHUGE 709.778 /* natural log of huge value */
65#define LOGTINY -708.396 /* natural log of tiny value */
66
67/* External declarations */
68
69extern int _fperr; /* floating point arithmetic error */
70extern int errno; /* UNIX error code */
71
72extern char *ecvt();
73extern short *seed48();
74extern int atoi(),matherr();
75extern long atol(),strtol(),lrand48(),nrand48(),mrand48(),jrand48();
76extern double atof(),exp(),log(),log10(),pow(),sqrt();
77extern double floor(),ceil(),fmod(),fabs(),frexp(),ldexp(),modf();
78extern double sinh(),cosh(),tanh(),sin(),cos(),tan(),cot(),asin(),acos();
79extern double atan(),atan2(),except();
80extern double drand48(),erand48();
Note: See TracBrowser for help on using the repository browser.