Headers and library sources from all versions of Lightspeed C and THINK C
1
2/*
3 * math.h
4 *
5 * Copyright (c) 1992 Symantec Corporation. All rights reserved.
6 *
7 */
8
9#pragma once
10
11#define _H_math
12
13extern short __D_INF[], __X_INF[];
14
15
16#ifdef __SC__ /* THINK C++ */
17
18#if __DOUBLE_8__
19#define HUGE_VAL (* (double *) __D_INF)
20#else
21#define HUGE_VAL (* (double *) __X_INF)
22#endif
23
24#else /* THINK C */
25
26#if !__option(thinkc)
27#define _NOINTRINSICS_
28#define _NOSYNONYMS_
29#endif
30
31#if __option(double_8)
32typedef long double _double;
33#define HUGE_VAL (* (double *) __D_INF)
34#else
35typedef double _double;
36#define HUGE_VAL (* (double *) __X_INF)
37#endif
38
39#endif
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45#ifndef __SANE__
46double atan(double);
47double cos(double);
48double exp(double);
49double fabs(double);
50double log(double);
51double sin(double);
52double sqrt(double);
53double tan(double);
54#endif
55
56double acos(double);
57double asin(double);
58double atan2(double, double);
59double ceil(double);
60double cosh(double);
61double floor(double);
62double fmod(double, double);
63double frexp(double, int *);
64double ldexp(double, int);
65double log10(double);
66double modf(double, double *);
67double pow(double, double);
68double sinh(double);
69double tanh(double);
70
71#ifdef __cplusplus
72}
73#endif
74
75
76#ifndef __SC__ /* THINK C */
77
78
79 /* 68881 intrinsics */
80
81#if __option(mc68881) && __option(thinkc)
82
83_double _acos(_double) : 0x1C;
84_double _asin(_double) : 0x0C;
85_double _atan(_double) : 0x0A;
86_double _cos(_double) : 0x1D;
87_double _cosh(_double) : 0x19;
88_double _exp(_double) : 0x10;
89_double _fabs(_double) : 0x18;
90_double _log(_double) : 0x14;
91_double _log10(_double) : 0x15;
92_double _sin(_double) : 0x0E;
93_double _sinh(_double) : 0x02;
94_double _sqrt(_double) : 0x04;
95_double _tan(_double) : 0x0F;
96_double _tanh(_double) : 0x09;
97
98#elif !defined(_NOSYNONYMS_)
99
100#define _acos(x) acos(x)
101#define _asin(x) asin(x)
102#define _atan(x) atan(x)
103#define _cos(x) cos(x)
104#define _cosh(x) cosh(x)
105#define _exp(x) exp(x)
106#define _fabs(x) fabs(x)
107#define _log(x) log(x)
108#define _log10(x) log10(x)
109#define _sin(x) sin(x)
110#define _sinh(x) sinh(x)
111#define _sqrt(x) sqrt(x)
112#define _tan(x) tan(x)
113#define _tanh(x) tanh(x)
114
115#endif
116
117#ifndef _NOSYNONYMS_
118#define _atan2(x, y) atan2(x, y)
119#define _ceil(x) ceil(x)
120#define _floor(x) floor(x)
121#define _fmod(x, y) fmod(x, y)
122#define _frexp(x, y) frexp(x, y)
123#define _ldexp(x, y) ldexp(x, y)
124#define _modf(x, y) modf(x, y)
125#define _pow(x, y) pow(x, y)
126#endif
127
128
129 /* map math functions to intrinsics */
130
131#if !defined(_NOINTRINSICS_) && !defined(__SANE__) && __option(mc68881) && !__option(double_8)
132
133#define atan(x) _atan(x)
134#define cos(x) _cos(x)
135#define fabs(x) _fabs(x)
136#define sin(x) _sin(x)
137#define tanh(x) _tanh(x)
138
139#ifdef _NOERRORCHECK_
140#define acos(x) _acos(x)
141#define asin(x) _asin(x)
142#define cosh(x) _cosh(x)
143#define exp(x) _exp(x)
144#define log(x) _log(x)
145#define log10(x) _log10(x)
146#define sinh(x) _sinh(x)
147#define sqrt(x) _sqrt(x)
148#define tan(x) _tan(x)
149#endif
150
151#endif
152
153
154#endif